Class: LazyRecords::Record
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- LazyRecords::Record
- Defined in:
- lib/record.rb
Instance Method Summary collapse
- #get_hash ⇒ Object
- #get_keywords ⇒ Object
- #get_values ⇒ Object
-
#initialize(hash = nil) ⇒ Record
constructor
A new instance of Record.
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_hash ⇒ Object
24 25 26 |
# File 'lib/record.rb', line 24 def get_hash self.instance_variable_get("@table") end |
#get_keywords ⇒ Object
28 29 30 |
# File 'lib/record.rb', line 28 def get_keywords get_hash.keys end |
#get_values ⇒ Object
32 33 34 |
# File 'lib/record.rb', line 32 def get_values get_hash.values end |