Class: Ni::Context::Errors
- Inherits:
-
Object
- Object
- Ni::Context::Errors
- Includes:
- Enumerable
- Defined in:
- lib/ni/context.rb
Instance Method Summary collapse
- #[]=(key, message) ⇒ Object
- #add(key, message) ⇒ Object
- #full_messages ⇒ Object
-
#initialize ⇒ Errors
constructor
A new instance of Errors.
- #to_h ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize ⇒ Errors
Returns a new instance of Errors.
8 9 10 |
# File 'lib/ni/context.rb', line 8 def initialize @errors = {} end |
Instance Method Details
#[]=(key, message) ⇒ Object
17 18 19 20 |
# File 'lib/ni/context.rb', line 17 def []=(key, ) @errors[key] ||= [] @errors[key] << end |
#add(key, message) ⇒ Object
12 13 14 15 |
# File 'lib/ni/context.rb', line 12 def add(key, ) @errors[key] ||= [] @errors[key] << end |
#full_messages ⇒ Object
22 23 24 |
# File 'lib/ni/context.rb', line 22 def @errors.values.flatten end |
#to_h ⇒ Object
26 27 28 |
# File 'lib/ni/context.rb', line 26 def to_h @errors end |
#to_json ⇒ Object
30 31 32 |
# File 'lib/ni/context.rb', line 30 def to_json to_h.to_json end |