Class: ViewComponent::Storybook::Controls::BooleanConfig
- Inherits:
-
SimpleControlConfig
- Object
- ControlConfig
- SimpleControlConfig
- ViewComponent::Storybook::Controls::BooleanConfig
- Defined in:
- lib/view_component/storybook/controls/boolean_config.rb
Constant Summary collapse
- BOOLEAN_VALUES =
[true, false].freeze
Instance Attribute Summary
Attributes inherited from SimpleControlConfig
Instance Method Summary collapse
Methods inherited from SimpleControlConfig
Methods inherited from ControlConfig
#description, #initialize, #name, #param, #prefix_param, #to_csf_params
Constructor Details
This class inherits a constructor from ViewComponent::Storybook::Controls::SimpleControlConfig
Instance Method Details
#type ⇒ Object
11 12 13 |
# File 'lib/view_component/storybook/controls/boolean_config.rb', line 11 def type :boolean end |
#value_from_params(params) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/view_component/storybook/controls/boolean_config.rb', line 15 def value_from_params(params) params_value = super(params) if params_value.is_a?(String) && params_value.present? case params_value when "true" true when "false" false end else params_value end end |