Class: MostOts::Base
- Inherits:
-
Object
- Object
- MostOts::Base
- Defined in:
- lib/most_ots/models/base.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(data) ⇒ Base
constructor
A new instance of Base.
- #method_missing(method_name, *args, &block) ⇒ Object
- #respond_to_missing?(method_name, _include_private = false) ⇒ Boolean
Constructor Details
#initialize(data) ⇒ Base
Returns a new instance of Base.
4 5 6 |
# File 'lib/most_ots/models/base.rb', line 4 def initialize(data) @data = data end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/most_ots/models/base.rb', line 8 def method_missing(method_name, *args, &block) if @data.key?(method_name) @data[method_name] else super end end |
Instance Method Details
#respond_to_missing?(method_name, _include_private = false) ⇒ Boolean
16 17 18 |
# File 'lib/most_ots/models/base.rb', line 16 def respond_to_missing?(method_name, _include_private = false) @data.key?(method_name) end |