Class: Hanami::Action::Params::Errors
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Hanami::Action::Params::Errors
- Defined in:
- gems/gems/hanami-controller-1.3.2/lib/hanami/action/params.rb,
gems/gems/hanami-controller-1.3.3/lib/hanami/action/params.rb
Overview
Params errors
Instance Method Summary collapse
-
#add(*args) ⇒ Object
Add an error to the param validations.
Instance Method Details
#add(*args) ⇒ Object
Add an error to the param validations
This has a semantic similar to Hash#dig
where you use a set of keys to get a nested value, here you use a set of keys to set a nested value.
Source: | on GitHub
def add(*args) *keys, key, error = args _nested_attribute(keys, key) << error rescue TypeError raise ArgumentError.new("Can't add #{args.map(&:inspect).join(', ')} to #{inspect}") end |