class Nyaplot::Color
The html interface to access Colorset
Public Class Methods
new(arr)
click to toggle source
# File lib/nyaplot/color.rb, line 60 def initialize(arr) @source = arr end
Public Instance Methods
each(&bl)
click to toggle source
# File lib/nyaplot/color.rb, line 56 def each(&bl) @source.each(&bl) end
method_missing(meth, *args, &block)
click to toggle source
Calls superclass method
# File lib/nyaplot/color.rb, line 83 def method_missing(meth, *args, &block) if [:size, :length, :[]].include?(meth) @source.send(meth, *args, &block) else super end end
respond_to?(meth)
click to toggle source
Calls superclass method
# File lib/nyaplot/color.rb, line 91 def respond_to?(meth) return true if [:size, :length, :[]].include?(meth) super end
to_a()
click to toggle source
# File lib/nyaplot/color.rb, line 64 def to_a @source end
to_html()
click to toggle source
display colorset on IRuby notebook as a html table @return [String] generated html
# File lib/nyaplot/color.rb, line 70 def to_html html = '<table><tr>' @source.each{|color| html.concat("<th>" + color + "</th>")} html.concat("</tr><tr>") @source.each{|color| html.concat("<td style=\"background-color:" + color + ";\"> </td>")} html += '</tr></table>' return html end
to_json(*args)
click to toggle source
# File lib/nyaplot/color.rb, line 79 def to_json(*args) @source.to_json end