Class: Hanami::Helpers::FormHelper::Values Private
- Inherits:
-
Object
- Object
- Hanami::Helpers::FormHelper::Values
- Defined in:
- lib/hanami/helpers/form_helper/values.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Values from params and form helpers.
It’s responsible to populate input values with data coming from params and inline values specified via form helpers like ‘text_field`.
Constant Summary collapse
- GET_SEPARATOR =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"."
Instance Attribute Summary collapse
- #csrf_token ⇒ Object readonly private
Instance Method Summary collapse
-
#get(*keys) ⇒ Object
private
Returns the value (if present) for the given key.
-
#initialize(values: {}, params: {}, csrf_token: nil) ⇒ Values
constructor
private
A new instance of Values.
Constructor Details
#initialize(values: {}, params: {}, csrf_token: nil) ⇒ Values
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Values.
24 25 26 27 28 |
# File 'lib/hanami/helpers/form_helper/values.rb', line 24 def initialize(values: {}, params: {}, csrf_token: nil) @values = values.to_h @params = params.to_h @csrf_token = csrf_token end |
Instance Attribute Details
#csrf_token ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 |
# File 'lib/hanami/helpers/form_helper/values.rb', line 20 def csrf_token @csrf_token end |
Instance Method Details
#get(*keys) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the value (if present) for the given key. Nested values are expressed with an array if symbols.
35 36 37 |
# File 'lib/hanami/helpers/form_helper/values.rb', line 35 def get(*keys) get_from_params(*keys) || get_from_values(*keys) end |