Class: Polar::Base
- Inherits:
-
Object
- Object
- Polar::Base
- Defined in:
- lib/polar/base.rb
Instance Method Summary collapse
-
#initialize(data) ⇒ Base
constructor
A new instance of Base.
- #method_missing(method_name, *attrs) ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(data) ⇒ Base
Returns a new instance of Base.
4 5 6 |
# File 'lib/polar/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, *attrs) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/polar/base.rb', line 8 def method_missing(method_name, *attrs) if @data.has_key?(method_name.to_s) return @data[method_name.to_s] else raise("No data for: #{method_name}") end end |
Instance Method Details
#to_h ⇒ Object
16 17 18 |
# File 'lib/polar/base.rb', line 16 def to_h @data end |