Class: ActiveadminSettingsCached::Coercions Private
- Inherits:
-
Object
- Object
- ActiveadminSettingsCached::Coercions
- Defined in:
- lib/activeadmin_settings_cached/coercions.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.
Coerce user input values to defined types
Instance Attribute Summary collapse
- #defaults ⇒ Object readonly private
- #display ⇒ Object readonly private
Instance Method Summary collapse
- #cast_params(params) ⇒ Object private
-
#initialize(defaults, display) ⇒ Coercions
constructor
private
A new instance of Coercions.
Constructor Details
#initialize(defaults, display) ⇒ Coercions
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 Coercions.
10 11 12 13 |
# File 'lib/activeadmin_settings_cached/coercions.rb', line 10 def initialize(defaults, display) @defaults = defaults @display = display end |
Instance Attribute Details
#defaults ⇒ 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.
8 9 10 |
# File 'lib/activeadmin_settings_cached/coercions.rb', line 8 def defaults @defaults end |
#display ⇒ 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.
8 9 10 |
# File 'lib/activeadmin_settings_cached/coercions.rb', line 8 def display @display end |
Instance Method Details
#cast_params(params) ⇒ 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.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/activeadmin_settings_cached/coercions.rb', line 15 def cast_params(params) coerced_params = params.to_unsafe_h.map do |name, value| [name, cast_value(name, value)] end return coerced_params unless block_given? coerced_params.each do |name, value| yield(name, value.call) unless value.nil? end end |