Class: MicroValidator::Errors
- Inherits:
-
Object
- Object
- MicroValidator::Errors
- Defined in:
- lib/micro_validator/errors.rb
Instance Method Summary collapse
- #add(attribute, message) ⇒ Object
- #all ⇒ Object
- #clear ⇒ Object
- #empty? ⇒ Boolean
- #field(name) ⇒ Object
Instance Method Details
#add(attribute, message) ⇒ Object
3 4 5 6 |
# File 'lib/micro_validator/errors.rb', line 3 def add(attribute, ) errors[attribute] ||= [] errors[attribute] << end |
#all ⇒ Object
16 17 18 |
# File 'lib/micro_validator/errors.rb', line 16 def all @errors end |
#clear ⇒ Object
8 9 10 |
# File 'lib/micro_validator/errors.rb', line 8 def clear @errors = {} end |
#empty? ⇒ Boolean
12 13 14 |
# File 'lib/micro_validator/errors.rb', line 12 def empty? errors.empty? end |
#field(name) ⇒ Object
20 21 22 |
# File 'lib/micro_validator/errors.rb', line 20 def field(name) @errors[name] end |