Class: ActiveNutrition::Objects::Base
- Inherits:
-
Object
- Object
- ActiveNutrition::Objects::Base
- Defined in:
- lib/active_nutrition/objects/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#base_model ⇒ Object
readonly
Returns the value of attribute base_model.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(base_model) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(base_model) ⇒ Base
Returns a new instance of Base.
8 9 10 |
# File 'lib/active_nutrition/objects/base.rb', line 8 def initialize(base_model) @base_model = base_model end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
6 7 8 |
# File 'lib/active_nutrition/objects/base.rb', line 6 def attributes @attributes end |
#base_model ⇒ Object (readonly)
Returns the value of attribute base_model.
6 7 8 |
# File 'lib/active_nutrition/objects/base.rb', line 6 def base_model @base_model end |
Class Method Details
.wrap(obj) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/active_nutrition/objects/base.rb', line 16 def self.wrap(obj) if obj.is_a?(Array) obj.map { |o| new(o) } else new(obj) end end |