Class: SmoothOperator::ArrayWithMetaData
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- SmoothOperator::ArrayWithMetaData
- Defined in:
- lib/smooth_operator/array_with_meta_data.rb
Instance Attribute Summary collapse
-
#internal_array ⇒ Object
readonly
Returns the value of attribute internal_array.
-
#meta_data ⇒ Object
readonly
Returns the value of attribute meta_data.
Instance Method Summary collapse
-
#initialize(attributes, object_class) ⇒ ArrayWithMetaData
constructor
A new instance of ArrayWithMetaData.
Constructor Details
#initialize(attributes, object_class) ⇒ ArrayWithMetaData
Returns a new instance of ArrayWithMetaData.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/smooth_operator/array_with_meta_data.rb', line 6 def initialize(attributes, object_class) resources_name = object_class.resources_name @internal_array = [*attributes[resources_name]].map do |array_entry| object_class.new(array_entry) end attributes.delete(resources_name) @meta_data = attributes super(@internal_array) end |
Instance Attribute Details
#internal_array ⇒ Object (readonly)
Returns the value of attribute internal_array.
4 5 6 |
# File 'lib/smooth_operator/array_with_meta_data.rb', line 4 def internal_array @internal_array end |
#meta_data ⇒ Object (readonly)
Returns the value of attribute meta_data.
4 5 6 |
# File 'lib/smooth_operator/array_with_meta_data.rb', line 4 def @meta_data end |