Class: Elos::Index::Model::Object
- Inherits:
-
Object
- Object
- Elos::Index::Model::Object
- Defined in:
- lib/elos/index/model/object.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Object
constructor
A new instance of Object.
- #method_missing(method, *args, **hargs, &block) ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Object
Returns a new instance of Object.
8 9 10 11 |
# File 'lib/elos/index/model/object.rb', line 8 def initialize(params = {}) @params = params @object = objectify(params) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, **hargs, &block) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/elos/index/model/object.rb', line 13 def method_missing(method, *args, **hargs, &block) if method.to_s.end_with?('=') object.send(method, objectify(args[0])) elsif object.respond_to?(method) object.send(method, *args) else super end end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
2 3 4 |
# File 'lib/elos/index/model/object.rb', line 2 def object @object end |
Class Method Details
.encode(object) ⇒ Object
4 5 6 |
# File 'lib/elos/index/model/object.rb', line 4 def self.encode(object) inner_encode(object).to_json end |