Class: Bound::BoundClass::NestedAttribute::ArrayAssigner

Inherits:
Object
  • Object
show all
Defined in:
lib/bound.rb

Instance Method Summary collapse

Constructor Details

#initialize(definitions) ⇒ ArrayAssigner

Returns a new instance of ArrayAssigner.



103
104
105
# File 'lib/bound.rb', line 103

def initialize(definitions)
  @bound_class = definitions.first
end

Instance Method Details

#resolve(arguments_list) ⇒ Object

Raises:

  • (ArgumentError)


107
108
109
110
111
112
# File 'lib/bound.rb', line 107

def resolve(arguments_list)
  raise ArgumentError.new("Expected #{arguments_list.inspect} to be an array") unless arguments_list.kind_of? Array
  arguments_list.map do |arguments|
    @bound_class.new(arguments)
  end
end