Class: Reform::Contract::Errors
- Inherits:
-
Object
- Object
- Reform::Contract::Errors
- Includes:
- Merge
- Defined in:
- lib/reform/contract/errors.rb
Defined Under Namespace
Modules: Merge
Instance Method Summary collapse
-
#[](name) ⇒ Object
needed by Rails form builder.
- #add(field, message) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ Errors
constructor
A new instance of Errors.
- #messages ⇒ Object
Methods included from Merge
Constructor Details
#initialize ⇒ Errors
Returns a new instance of Errors.
2 3 4 |
# File 'lib/reform/contract/errors.rb', line 2 def initialize(*) @errors = {} end |
Instance Method Details
#[](name) ⇒ Object
needed by Rails form builder.
40 41 42 |
# File 'lib/reform/contract/errors.rb', line 40 def [](name) @errors[name] || [] end |
#add(field, message) ⇒ Object
26 27 28 29 |
# File 'lib/reform/contract/errors.rb', line 26 def add(field, ) @errors[field] ||= [] @errors[field] << end |
#empty? ⇒ Boolean
35 36 37 |
# File 'lib/reform/contract/errors.rb', line 35 def empty? @errors.empty? end |
#messages ⇒ Object
31 32 33 |
# File 'lib/reform/contract/errors.rb', line 31 def @errors end |