Class: LazyRecords::Record

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/record.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash = nil) ⇒ Record

Returns a new instance of Record.



13
14
15
16
17
18
19
20
21
22
# File 'lib/record.rb', line 13

def initialize(hash=nil)
  @table = {}
  if hash
    hash.each_pair do |k, v|
      k = k.to_s.to_sym
      @table[k] = v
      new_ostruct_member(k)
    end
  end
end

Instance Method Details

#get_hashObject



24
25
26
# File 'lib/record.rb', line 24

def get_hash
  self.instance_variable_get("@table")
end

#get_keywordsObject



28
29
30
# File 'lib/record.rb', line 28

def get_keywords
  get_hash.keys
end

#get_valuesObject



32
33
34
# File 'lib/record.rb', line 32

def get_values
  get_hash.values
end