Class: ActionView::Storybook::Controls::ControlConfig
- Inherits:
-
Object
- Object
- ActionView::Storybook::Controls::ControlConfig
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/action_view/storybook/controls/control_config.rb
Direct Known Subclasses
ArrayConfig, BooleanConfig, ColorConfig, DateConfig, NumberConfig, ObjectConfig, OptionsConfig, TextConfig
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#param ⇒ Object
readonly
Returns the value of attribute param.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(param, value, name: nil) ⇒ ControlConfig
constructor
A new instance of ControlConfig.
- #to_csf_params ⇒ Object
- #value_from_param(param) ⇒ Object
Constructor Details
#initialize(param, value, name: nil) ⇒ ControlConfig
Returns a new instance of ControlConfig.
13 14 15 16 17 |
# File 'lib/action_view/storybook/controls/control_config.rb', line 13 def initialize(param, value, name: nil) @param = param @value = value @name = name || param.to_s.humanize.titlecase end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/action_view/storybook/controls/control_config.rb', line 9 def name @name end |
#param ⇒ Object (readonly)
Returns the value of attribute param.
9 10 11 |
# File 'lib/action_view/storybook/controls/control_config.rb', line 9 def param @param end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
9 10 11 |
# File 'lib/action_view/storybook/controls/control_config.rb', line 9 def value @value end |
Instance Method Details
#to_csf_params ⇒ Object
19 20 21 22 23 24 |
# File 'lib/action_view/storybook/controls/control_config.rb', line 19 def to_csf_params { args: { param => csf_value }, argTypes: { param => { control: csf_control_params, name: name } } } end |
#value_from_param(param) ⇒ Object
26 27 28 |
# File 'lib/action_view/storybook/controls/control_config.rb', line 26 def value_from_param(param) param end |