Class: Redox::Models::Model
- Inherits:
-
AbstractModel
- Object
- Hashie::Trash
- AbstractModel
- Redox::Models::Model
- Defined in:
- lib/redox/models/model.rb
Constant Summary
Constants inherited from AbstractModel
AbstractModel::HIGH_LEVEL_KEYS
Instance Method Summary collapse
-
#initialize(data = {}) ⇒ Model
constructor
A new instance of Model.
- #to_h ⇒ Object
Methods inherited from AbstractModel
add_helpers, from_response, from_response_inflected, get_inflected_class, #insurances, #to_json
Constructor Details
#initialize(data = {}) ⇒ Model
Returns a new instance of Model.
101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/redox/models/model.rb', line 101 def initialize(data = {}) if data.is_a?(Hash) if data.include?(key) data = data[key] elsif data.include?(key.to_sym) data = data[key.to_sym] end end super end |
Instance Method Details
#to_h ⇒ Object
113 114 115 |
# File 'lib/redox/models/model.rb', line 113 def to_h { key => super.to_h } end |