Class: Ghtk::FlexibleParams
- Inherits:
-
Object
- Object
- Ghtk::FlexibleParams
- Defined in:
- lib/ghtk/flexible_params.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
Instance Method Summary collapse
-
#initialize(object) ⇒ FlexibleParams
constructor
A new instance of FlexibleParams.
Constructor Details
#initialize(object) ⇒ FlexibleParams
Returns a new instance of FlexibleParams.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/ghtk/flexible_params.rb', line 6 def initialize(object) if object.is_a?(Hash) data = object elsif object.respond_to?(:as_json) data = object.as_json else data = object.attributes end @hash = data.to_deep_symbolize_keys end |
Instance Attribute Details
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
4 5 6 |
# File 'lib/ghtk/flexible_params.rb', line 4 def hash @hash end |