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.
1116 1117 1118 |
# File 'lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb', line 1116 def initialize @attribute_setters = [] end |
Instance Method Details
#+(other_attribute_setters) ⇒ Object
1130 1131 1132 1133 1134 1135 1136 |
# 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 |
#<<(given_attribute_setter) ⇒ Object
1120 1121 1122 1123 1124 1125 1126 1127 1128 |
# 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 |
#each(&block) ⇒ Object
1138 1139 1140 |
# File 'lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb', line 1138 def each(&block) @attribute_setters.each(&block) end |
#last ⇒ Object
1142 1143 1144 |
# File 'lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb', line 1142 def last @attribute_setters.last end |