Sha256: 4320a2561f77555f3ca048d955505337baab04ed22e6dbef306b562a8352f0d1

Contents?: true

Size: 530 Bytes

Versions: 5

Compression:

Stored size: 530 Bytes

Contents

class MetaReports::Data
  def initialize
    @hash = {tables: {}}
    yield self if block_given?
    self
  end

  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

  def [](key)
    @hash[key]
  end

  def []=(key, value)
    @hash[key] = value
  end

  def tables
    @hash[:tables]
  end

  def to_h
    @hash
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
meta_reports-0.0.5 app/models/meta_reports/data.rb
meta_reports-0.0.4 app/models/meta_reports/data.rb
meta_reports-0.0.3 app/models/meta_reports/data.rb
meta_reports-0.0.2 app/models/meta_reports/data.rb
meta_reports-0.0.1 app/models/meta_reports/data.rb