Class: Shoulda::Matchers::ActiveRecord::ValidateUniquenessOfMatcher::AttributeSetters
- Inherits:
-
Object
- Object
- Shoulda::Matchers::ActiveRecord::ValidateUniquenessOfMatcher::AttributeSetters
- Includes:
- Enumerable
- Defined in:
- lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb
Instance Method Summary collapse
- #+(other_attribute_setters) ⇒ Object
- #<<(given_attribute_setter) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize ⇒ AttributeSetters
constructor
A new instance of AttributeSetters.
- #last ⇒ Object
Constructor Details
#initialize ⇒ AttributeSetters
Returns a new instance of AttributeSetters.
1057 1058 1059 |
# File 'lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb', line 1057 def initialize @attribute_setters = [] end |
Instance Method Details
#+(other_attribute_setters) ⇒ Object
1071 1072 1073 1074 1075 1076 1077 |
# File 'lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb', line 1071 def +(other_attribute_setters) dup.tap do |attribute_setters| other_attribute_setters.each do |attribute_setter| attribute_setters << attribute_setter end end end |
#<<(given_attribute_setter) ⇒ Object
1061 1062 1063 1064 1065 1066 1067 1068 1069 |
# File 'lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb', line 1061 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 |
#each(&block) ⇒ Object
1079 1080 1081 |
# File 'lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb', line 1079 def each(&block) @attribute_setters.each(&block) end |
#last ⇒ Object
1083 1084 1085 |
# File 'lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb', line 1083 def last @attribute_setters.last end |