class MetaReports::Table

Public Class Methods

new() { |self| ... } click to toggle source
# File lib/meta_reports/table.rb, line 5
def initialize
  @data = []
  @options = {row_classes: {}}
  yield self if block_given?
end

Public Instance Methods

+(arr) click to toggle source
# File lib/meta_reports/table.rb, line 46
def +(arr)
  @data += arr
end
<<(val) click to toggle source

data methods

# File lib/meta_reports/table.rb, line 42
def <<(val)
  @data << val
end
[](key) click to toggle source

options methods

# File lib/meta_reports/table.rb, line 24
def [](key)
  @options[key]
end
[]=(key,val) click to toggle source
# File lib/meta_reports/table.rb, line 28
def []=(key,val)
  @options[key] = val
end
data()
Alias for: to_a
data=(value) click to toggle source
# File lib/meta_reports/table.rb, line 78
def data=(value)
  @data = value
end
first() click to toggle source
# File lib/meta_reports/table.rb, line 50
def first
  @data.first
end
last() click to toggle source
# File lib/meta_reports/table.rb, line 54
def last
  @data.last
end
length() click to toggle source
# File lib/meta_reports/table.rb, line 58
def length
  @data.length
end
method_missing(method, *args, &block) click to toggle source
Calls superclass method
# File lib/meta_reports/table.rb, line 11
def method_missing(method, *args, &block)
  method_string = method.to_s
  if method_string =~ /^(.+)=$/
    @options[$1.to_sym] = args.first
  elsif @options[method.to_sym]
    @options[method.to_sym]
  else
    super
  end
end
options() click to toggle source
# File lib/meta_reports/table.rb, line 32
def options
  @options
end
pop() click to toggle source
# File lib/meta_reports/table.rb, line 62
def pop
  @data.pop
end
push(val) click to toggle source
# File lib/meta_reports/table.rb, line 66
def push(val)
  @data.push(val)
end
row_classes() click to toggle source
# File lib/meta_reports/table.rb, line 36
def row_classes
  @options[:row_classes]
end
shift() click to toggle source
# File lib/meta_reports/table.rb, line 70
def shift
  @data.shift
end
to_a() click to toggle source
# File lib/meta_reports/table.rb, line 74
def to_a
  @data
end
Also aliased as: data
unshift(val) click to toggle source
# File lib/meta_reports/table.rb, line 82
def unshift(val)
  @data.unshift(val)
end