Class: Morpho::Grape::DataWrapper
- Inherits:
-
Object
- Object
- Morpho::Grape::DataWrapper
- Defined in:
- lib/morpho/grape/data_wrapper.rb
Instance Attribute Summary collapse
-
#is_array ⇒ Object
readonly
Returns the value of attribute is_array.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#wrapper_name ⇒ Object
readonly
Returns the value of attribute wrapper_name.
Instance Method Summary collapse
- #ancestors ⇒ Object
-
#initialize(model, wrapper_name: nil, key: :data, is_array: false) ⇒ DataWrapper
constructor
A new instance of DataWrapper.
- #to_s ⇒ Object
Constructor Details
#initialize(model, wrapper_name: nil, key: :data, is_array: false) ⇒ DataWrapper
Returns a new instance of DataWrapper.
9 10 11 12 13 14 |
# File 'lib/morpho/grape/data_wrapper.rb', line 9 def initialize(model, wrapper_name: nil, key: :data, is_array: false) @model = model @wrapper_name = wrapper_name @key = key @is_array = is_array end |
Instance Attribute Details
#is_array ⇒ Object (readonly)
Returns the value of attribute is_array.
6 7 8 |
# File 'lib/morpho/grape/data_wrapper.rb', line 6 def is_array @is_array end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
5 6 7 |
# File 'lib/morpho/grape/data_wrapper.rb', line 5 def key @key end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
4 5 6 |
# File 'lib/morpho/grape/data_wrapper.rb', line 4 def model @model end |
#wrapper_name ⇒ Object (readonly)
Returns the value of attribute wrapper_name.
7 8 9 |
# File 'lib/morpho/grape/data_wrapper.rb', line 7 def wrapper_name @wrapper_name end |
Instance Method Details
#ancestors ⇒ Object
16 17 18 |
# File 'lib/morpho/grape/data_wrapper.rb', line 16 def ancestors [DataWrapper] end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/morpho/grape/data_wrapper.rb', line 20 def to_s wrapper_name ? wrapper_name : "data_wrapper_#{object_id}" end |