Class: RecordX
- Inherits:
-
Object
- Object
- RecordX
- Defined in:
- lib/recordx.rb
Overview
file: recordx.rb
Defined Under Namespace
Classes: RXHash
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #delete ⇒ Object
- #h ⇒ Object (also: #to_h)
-
#initialize(h = {}, callerx = nil, id = nil) ⇒ RecordX
constructor
A new instance of RecordX.
- #inspect ⇒ Object
- #update(h) ⇒ Object
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *raw_args) ⇒ Object (private)
50 51 52 53 54 |
# File 'lib/recordx.rb', line 50 def method_missing(method_name, *raw_args) arg = raw_args.length > 0 ? raw_args.first : nil attr_accessor2(method_name[/\w+/], arg) arg ? self.send(method_name, arg) : self.send(method_name) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/recordx.rb', line 7 def id @id end |
Instance Method Details
#delete ⇒ Object
30 31 32 |
# File 'lib/recordx.rb', line 30 def delete() @callerx.delete @id end |
#h ⇒ Object Also known as: to_h
34 35 36 |
# File 'lib/recordx.rb', line 34 def h() @h end |
#inspect ⇒ Object
38 39 40 |
# File 'lib/recordx.rb', line 38 def inspect() "<object #%s>" % [self.object_id] end |
#update(h) ⇒ Object
44 45 46 |
# File 'lib/recordx.rb', line 44 def update(h) h.each {|name,value| self.method((name.to_s + '=').to_sym).call(value) } end |