Class: ObjectValidator::Errors
- Inherits:
-
Object
- Object
- ObjectValidator::Errors
- Defined in:
- lib/object_validator/errors.rb
Instance Attribute Summary collapse
-
#all ⇒ Object
Returns the value of attribute all.
Instance Method Summary collapse
- #add(name, msg) ⇒ Object
- #full_messages ⇒ Object
-
#initialize ⇒ Errors
constructor
A new instance of Errors.
Constructor Details
#initialize ⇒ Errors
Returns a new instance of Errors.
5 6 7 8 |
# File 'lib/object_validator/errors.rb', line 5 def initialize @all = {} = [] end |
Instance Attribute Details
#all ⇒ Object
Returns the value of attribute all.
3 4 5 |
# File 'lib/object_validator/errors.rb', line 3 def all @all end |
Instance Method Details
#add(name, msg) ⇒ Object
10 11 12 |
# File 'lib/object_validator/errors.rb', line 10 def add(name, msg) (@all[name] ||= []) << msg end |
#full_messages ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/object_validator/errors.rb', line 14 def @all.map do |error| attr, errors = *error errors.each { |e| << "#{attr.to_s.capitalize} #{e}." } end end |