Class: ActionView::Storybook::Controls::BooleanConfig

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

Constant Summary collapse

BOOLEAN_VALUES =
[true, false].freeze

Instance Attribute Summary

Attributes inherited from ControlConfig

#name, #param, #value

Instance Method Summary collapse

Methods inherited from ControlConfig

#initialize, #to_csf_params

Constructor Details

This class inherits a constructor from ActionView::Storybook::Controls::ControlConfig

Instance Method Details

#typeObject



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

def type
  :boolean
end

#value_from_param(param) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/action_view/storybook/controls/boolean_config.rb', line 15

def value_from_param(param)
  if param.is_a?(String) && param.present?
    case param
    when "true"
      true
    when "false"
      false
    end
  else
    super(param)
  end
end