Class: ViewComponent::Storybook::Controls::Boolean

Inherits:
SimpleControl show all
Defined in:
lib/view_component/storybook/controls/boolean.rb

Constant Summary collapse

BOOLEAN_VALUES =
[true, false].freeze

Instance Attribute Summary

Attributes inherited from Control

#default, #description, #name, #param

Instance Method Summary collapse

Methods inherited from SimpleControl

#initialize, #to_csf_params

Methods inherited from Control

#initialize, #to_csf_params

Constructor Details

This class inherits a constructor from ViewComponent::Storybook::Controls::SimpleControl

Instance Method Details

#parse_param_value(value) ⇒ Object



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

def parse_param_value(value)
  if value.is_a?(String) && value.present?
    case value
    when "true"
      true
    when "false"
      false
    end
  else
    value
  end
end

#typeObject



11
12
13
# File 'lib/view_component/storybook/controls/boolean.rb', line 11

def type
  :boolean
end