class MetaReports::Data

Public Class Methods

new() { |self| ... } click to toggle source
# File lib/meta_reports/data.rb, line 3
def initialize
  @hash = {tables: {}}
  @id = rand(10000)
  yield self if block_given?
  self
end

Public Instance Methods

[](key) click to toggle source
# File lib/meta_reports/data.rb, line 21
def [](key)
  @hash[key]
end
[]=(key, value) click to toggle source
# File lib/meta_reports/data.rb, line 25
def []=(key, value)
  @hash[key] = value
end
id() click to toggle source
# File lib/meta_reports/data.rb, line 29
def id
  @hash[:id] || @hash[:title].to_s.downcase.gsub(/[^a-z]/,'_') || @id
end
method_missing(method, *args, &block) click to toggle source
# File lib/meta_reports/data.rb, line 10
def method_missing(method, *args, &block)
  method_string = method.to_s
  if method_string =~ /^(.+)=$/
    @hash[$1.to_sym] = args.first
  elsif @hash[method.to_sym]
    @hash[method.to_sym]
  else
    @hash.send(method, *args)
  end
end
tables() click to toggle source
# File lib/meta_reports/data.rb, line 33
def tables
  @hash[:tables]
end
tables=(value) click to toggle source
# File lib/meta_reports/data.rb, line 37
def tables=(value)
  @hash[:tables] = value
end
to_h() click to toggle source
# File lib/meta_reports/data.rb, line 41
def to_h
  @hash
end