Class: ViewComponent::Storybook::Controls::DateConfig
- Inherits:
-
SimpleControlConfig
- Object
- ControlConfig
- SimpleControlConfig
- ViewComponent::Storybook::Controls::DateConfig
- Defined in:
- lib/view_component/storybook/controls/date_config.rb
Instance Attribute Summary
Attributes inherited from SimpleControlConfig
Instance Method Summary collapse
-
#initialize(default_value, param: nil, name: nil, description: nil) ⇒ DateConfig
constructor
A new instance of DateConfig.
- #type ⇒ Object
- #value_from_params(params) ⇒ Object
Methods inherited from SimpleControlConfig
Methods inherited from ControlConfig
#description, #name, #param, #prefix_param, #to_csf_params
Constructor Details
#initialize(default_value, param: nil, name: nil, description: nil) ⇒ DateConfig
Returns a new instance of DateConfig.
7 8 9 |
# File 'lib/view_component/storybook/controls/date_config.rb', line 7 def initialize(default_value, param: nil, name: nil, description: nil) super(default_value, param: param, name: name, description: description) end |
Instance Method Details
#type ⇒ Object
11 12 13 |
# File 'lib/view_component/storybook/controls/date_config.rb', line 11 def type :date end |
#value_from_params(params) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/view_component/storybook/controls/date_config.rb', line 15 def value_from_params(params) params_value = super(params) if params_value.is_a?(String) DateTime.iso8601(params_value) else params_value end end |