Class: Hanami::Helpers::FormHelper::Values Private

Inherits:
Object
  • Object
show all
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`.

Since:

  • 0.2.0

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.

Since:

  • 0.2.0

'.'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(values, params) ⇒ 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.

Since:

  • 0.2.0



20
21
22
23
# File 'lib/hanami/helpers/form_helper/values.rb', line 20

def initialize(values, params)
  @values = Utils::Hash.symbolize(values || {})
  @params = params
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.

Since:

  • 0.2.0



30
31
32
# File 'lib/hanami/helpers/form_helper/values.rb', line 30

def get(*keys)
  _get_from_params(*keys) || _get_from_values(*keys)
end