Class: BazaModels::Errors
- Inherits:
-
Object
- Object
- BazaModels::Errors
- Defined in:
- lib/baza_models/errors.rb
Defined Under Namespace
Classes: InvalidRecord
Instance Method Summary collapse
- #add(attribute_name, error) ⇒ Object
- #any? ⇒ Boolean
- #empty? ⇒ Boolean
- #full_messages ⇒ Object
-
#initialize ⇒ Errors
constructor
A new instance of Errors.
Constructor Details
#initialize ⇒ Errors
Returns a new instance of Errors.
4 5 6 |
# File 'lib/baza_models/errors.rb', line 4 def initialize @errors = {} end |
Instance Method Details
#add(attribute_name, error) ⇒ Object
8 9 10 11 |
# File 'lib/baza_models/errors.rb', line 8 def add(attribute_name, error) @errors[attribute_name] ||= [] @errors[attribute_name] << error end |
#any? ⇒ Boolean
27 28 29 |
# File 'lib/baza_models/errors.rb', line 27 def any? .any? end |
#empty? ⇒ Boolean
23 24 25 |
# File 'lib/baza_models/errors.rb', line 23 def empty? .empty? end |
#full_messages ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/baza_models/errors.rb', line 13 def = [] @errors.each do |attribute_name, errors| += errors end return end |