Class: ActionView::Storybook::Controls::ArrayConfig

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

Instance Attribute Summary collapse

Attributes inherited from ControlConfig

#name, #param, #value

Instance Method Summary collapse

Methods inherited from ControlConfig

#to_csf_params

Constructor Details

#initialize(param, value, separator = ",", name: nil) ⇒ ArrayConfig

Returns a new instance of ArrayConfig.



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

def initialize(param, value, separator = ",", name: nil)
  super(param, value, name: name)
  @separator = separator
end

Instance Attribute Details

#separatorObject (readonly)

Returns the value of attribute separator.



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

def separator
  @separator
end

Instance Method Details

#typeObject



16
17
18
# File 'lib/action_view/storybook/controls/array_config.rb', line 16

def type
  :array
end

#value_from_param(param) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/action_view/storybook/controls/array_config.rb', line 20

def value_from_param(param)
  if param.is_a?(String)
    param.split(separator)
  else
    super(param)
  end
end