class Nyaplot::Series

Public Class Methods

new(label, arr) click to toggle source
# File lib/nyaplot/data.rb, line 191
def initialize(label, arr)
  @arr = arr
  @label = label
end

Public Instance Methods

each(&block) click to toggle source
# File lib/nyaplot/data.rb, line 187
def each(&block)
  @arr.each(&block)
end
label() click to toggle source
# File lib/nyaplot/data.rb, line 214
def label
  @label
end
method_missing(meth, *args, &block) click to toggle source
Calls superclass method
# File lib/nyaplot/data.rb, line 218
def method_missing(meth, *args, &block)
  if @arr.respond_to?(meth)
    @arr.send(meth, *args, &block)
  else
    super(meth, *args, &block)
  end
end
respond_to?(meth) click to toggle source
Calls superclass method
# File lib/nyaplot/data.rb, line 226
def respond_to?(meth)
  return true if @arr.respond_to?(meth)
  super(meth)
end
to_a() click to toggle source
# File lib/nyaplot/data.rb, line 210
def to_a
  @arr
end
to_html(threshold=15) click to toggle source
# File lib/nyaplot/data.rb, line 196
def to_html(threshold=15)
  html = '<table><tr><th>' + label.to_s + '</th></tr>>'
  @arr.each_with_index do |el,i|
    next if threshold < i && i < @arr.length-1
    content = i == threshold ? '...' : el.to_s
    html.concat('<tr><td>' + content  + '</td></tr>')
  end
  html += '</table>'
end
to_json(*args) click to toggle source
# File lib/nyaplot/data.rb, line 206
def to_json(*args)
  @arr.to_json
end