Class: ActiveModel::BetterErrors::ErrorMessageSet
- Inherits:
-
Array
- Object
- Array
- ActiveModel::BetterErrors::ErrorMessageSet
- Defined in:
- lib/active_model/better_errors/error_message_set.rb
Overview
ErrorMessageSet
Instance Method Summary collapse
- #<<(error) ⇒ Object
- #[]=(index, error) ⇒ Object
-
#initialize(base, attribute, errors = []) ⇒ ErrorMessageSet
constructor
A new instance of ErrorMessageSet.
- #insert(index, error) ⇒ Object
- #push(message, options = {}) ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(base, attribute, errors = []) ⇒ ErrorMessageSet
Returns a new instance of ErrorMessageSet.
9 10 11 12 13 14 15 |
# File 'lib/active_model/better_errors/error_message_set.rb', line 9 def initialize(base, attribute, errors = []) @base = base @attribute = attribute errors.each do |error| push(*error) end end |
Instance Method Details
#<<(error) ⇒ Object
17 18 19 |
# File 'lib/active_model/better_errors/error_message_set.rb', line 17 def <<(error) super ErrorMessage.build(@base, @attribute, *error) end |
#[]=(index, error) ⇒ Object
25 26 27 |
# File 'lib/active_model/better_errors/error_message_set.rb', line 25 def []=(index, error) super index, ErrorMessage.build(@base, @attribute, *error) end |
#insert(index, error) ⇒ Object
29 30 31 |
# File 'lib/active_model/better_errors/error_message_set.rb', line 29 def insert(index, error) super index, ErrorMessage.build(@base, @attribute, *error) end |
#push(message, options = {}) ⇒ Object
21 22 23 |
# File 'lib/active_model/better_errors/error_message_set.rb', line 21 def push(, = {}) super ErrorMessage.build(@base, @attribute, , ) end |
#to_a ⇒ Object
33 34 35 |
# File 'lib/active_model/better_errors/error_message_set.rb', line 33 def to_a dup end |