Class: ActionView::Storybook::Controls::DateConfig

Inherits:
ControlConfig
  • Object
show all
Defined in:
lib/action_view/storybook/controls/date_config.rb

Instance Attribute Summary

Attributes inherited from ControlConfig

#name, #param, #value

Instance Method Summary collapse

Methods inherited from ControlConfig

#to_csf_params

Constructor Details

#initialize(param, value, name: nil) ⇒ DateConfig

Returns a new instance of DateConfig.



7
8
9
# File 'lib/action_view/storybook/controls/date_config.rb', line 7

def initialize(param, value, name: nil)
  super(param, value, name: name)
end

Instance Method Details

#typeObject



11
12
13
# File 'lib/action_view/storybook/controls/date_config.rb', line 11

def type
  :date
end

#value_from_param(param) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/action_view/storybook/controls/date_config.rb', line 15

def value_from_param(param)
  if param.is_a?(String)
    DateTime.iso8601(param)
  else
    super(param)
  end
end