class Shoulda::Matchers::ActiveModel::AllowValueMatcher::AttributeSetters

@private

Attributes

tuples[R]

Public Class Methods

new(allow_value_matcher, values) click to toggle source
# File lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters.rb, line 9
def initialize(allow_value_matcher, values)
  @tuples = values.map do |attribute_name, value|
    AttributeSetterAndValidator.new(
      allow_value_matcher,
      attribute_name,
      value
    )
  end
end

Public Instance Methods

each(&block) click to toggle source
# File lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters.rb, line 19
def each(&block)
  tuples.each(&block)
end
first_failing() click to toggle source
# File lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters.rb, line 23
def first_failing
  tuples.detect(&method(:does_not_match?))
end

Private Instance Methods

does_not_match?(tuple) click to toggle source
# File lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters.rb, line 33
def does_not_match?(tuple)
  !tuple.attribute_setter.set!
end