class ActionView::Storybook::Controls::OptionsConfig

Constants

TYPES

Attributes

options[R]
symbol_value[R]
type[R]

Public Class Methods

inclusion_in(config) click to toggle source

support the options being a Hash or an Array. Storybook supports either.

# File lib/action_view/storybook/controls/options_config.rb, line 9
def inclusion_in(config)
  case config.options
  when Hash
    config.options.values
  when Array
    config.options
  end
end
new(type, param, options, default_value, name: nil) click to toggle source
# File lib/action_view/storybook/controls/options_config.rb, line 27
def initialize(type, param, options, default_value, name: nil)
  super(param, default_value, name: name)
  @type = type
  @options = options
  @symbol_value = default_value.is_a?(Symbol)
end

Public Instance Methods

value_from_param(param) click to toggle source
# File lib/action_view/storybook/controls/options_config.rb, line 34
def value_from_param(param)
  if param.is_a?(String) && symbol_value
    param.to_sym
  else
    super(param)
  end
end

Private Instance Methods

csf_control_params() click to toggle source
# File lib/action_view/storybook/controls/options_config.rb, line 44
def csf_control_params
  super.merge(options: options)
end