class Shoulda::Matchers::ActiveModel::AllowValueMatcher::AttributeSettersAndValidators
@private
Attributes
Public Class Methods
Source
# File lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters_and_validators.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
Source
# File lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters_and_validators.rb, line 19 def each(&block) tuples.each(&block) end
Source
# File lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters_and_validators.rb, line 27 def first_failing tuples.detect(&method(:does_not_match?)) end
Source
# File lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters_and_validators.rb, line 23 def first_passing tuples.detect(&method(:matches?)) end
Private Instance Methods
Source
# File lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters_and_validators.rb, line 41 def does_not_match?(tuple) !matches?(tuple) end
Source
# File lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters_and_validators.rb, line 37 def matches?(tuple) tuple.attribute_setter.set! && tuple.validator.call end