Class: SmoothOperator::ArrayWithMetaData

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/smooth_operator/array_with_meta_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

  define_metada_methods

  super(@internal_array)
end

Instance Attribute Details

#internal_arrayObject (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_dataObject (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