Class: Replicate::Record::Base
- Inherits:
-
Object
- Object
- Replicate::Record::Base
- Defined in:
- lib/replicate/record/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(client, params) ⇒ Base
constructor
A new instance of Base.
- #inspect ⇒ Object
- #method_missing(method_name, *args, &block) ⇒ Object
Constructor Details
#initialize(client, params) ⇒ Base
Returns a new instance of Base.
9 10 11 12 |
# File 'lib/replicate/record/base.rb', line 9 def initialize(client, params) @client = client @data = params end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/replicate/record/base.rb', line 14 def method_missing(method_name, *args, &block) if data.key? method_name.to_s data[method_name.to_s] else super end end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/replicate/record/base.rb', line 7 def client @client end |
#data ⇒ Object
Returns the value of attribute data.
6 7 8 |
# File 'lib/replicate/record/base.rb', line 6 def data @data end |
Instance Method Details
#inspect ⇒ Object
22 23 24 25 26 |
# File 'lib/replicate/record/base.rb', line 22 def inspect string = "#<#{self.class.name}:#{object_id} " fields = data.map { |attr, value| "#{attr}: #{value.inspect}" } string << fields.join(", ") << ">" end |