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.



93
94
95
# File 'lib/bound.rb', line 93

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

Instance Method Details

#resolve(arguments_list) ⇒ Object

Raises:

  • (ArgumentError)


97
98
99
100
101
102
# File 'lib/bound.rb', line 97

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