Class: ElasticWeb::Relation
- Inherits:
-
Object
- Object
- ElasticWeb::Relation
- Defined in:
- lib/elasticweb/relation.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(data) ⇒ Relation
constructor
A new instance of Relation.
- #method_missing(method_sym, *arguments, &block) ⇒ Object
Constructor Details
#initialize(data) ⇒ Relation
Returns a new instance of Relation.
5 6 7 |
# File 'lib/elasticweb/relation.rb', line 5 def initialize(data) @data = OpenStruct.new(data) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_sym, *arguments, &block) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/elasticweb/relation.rb', line 9 def method_missing(method_sym, *arguments, &block) if @data.respond_to?(method_sym) @data.send(method_sym) else super end end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/elasticweb/relation.rb', line 3 def data @data end |