Class: ViewComponent::Storybook::Controls::ObjectConfig
- Inherits:
-
SimpleControlConfig
- Object
- ControlConfig
- SimpleControlConfig
- ViewComponent::Storybook::Controls::ObjectConfig
- Defined in:
- lib/view_component/storybook/controls/object_config.rb
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
7 8 9 |
# File 'lib/view_component/storybook/controls/object_config.rb', line 7 def type :object end |
#value_from_params(params) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/view_component/storybook/controls/object_config.rb', line 11 def value_from_params(params) params_value = super(params) if params_value.is_a?(String) parsed_json = JSON.parse(params_value) if parsed_json.is_a?(Array) parsed_json.map do |item| item.is_a?(Hash) ? item.deep_symbolize_keys : item end else parsed_json.deep_symbolize_keys end else params_value end end |