class Shoulda::Matchers::ActiveRecord::ValidateUniquenessOfMatcher::AttributeSetters
@private
Public Class Methods
Source
# File lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb, line 1116 def initialize @attribute_setters = [] end
Public Instance Methods
Source
# File lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb, line 1130 def +(other_attribute_setters) dup.tap do |attribute_setters| other_attribute_setters.each do |attribute_setter| attribute_setters << attribute_setter end end end
Source
# File lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb, line 1120 def <<(given_attribute_setter) index = find_index_of(given_attribute_setter) if index @attribute_setters[index] = given_attribute_setter else @attribute_setters << given_attribute_setter end end
Source
# File lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb, line 1138 def each(&block) @attribute_setters.each(&block) end
Source
# File lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb, line 1142 def last @attribute_setters.last end
Private Instance Methods
Source
# File lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb, line 1148 def find_index_of(given_attribute_setter) @attribute_setters.find_index do |attribute_setter| attribute_setter.attribute_name == given_attribute_setter.attribute_name end end