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.
1106 1107 1108 |
# File 'lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb', line 1106 def initialize @attribute_setters = [] end |
Instance Method Details
#+(other_attribute_setters) ⇒ Object
1120 1121 1122 1123 1124 1125 1126 |
# File 'lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb', line 1120 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
1110 1111 1112 1113 1114 1115 1116 1117 1118 |
# File 'lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb', line 1110 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
1128 1129 1130 |
# File 'lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb', line 1128 def each(&block) @attribute_setters.each(&block) end |
#last ⇒ Object
1132 1133 1134 |
# File 'lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb', line 1132 def last @attribute_setters.last end |