Class: ViewComponent::Storybook::Controls::BaseOptions

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

Direct Known Subclasses

MultiOptions, Options

Instance Attribute Summary collapse

Attributes inherited from Control

#default, #description, #name, #param

Instance Method Summary collapse

Methods inherited from SimpleControl

#parse_param_value

Methods inherited from Control

#parse_param_value

Constructor Details

#initialize(param, type:, options:, default: nil, labels: nil, name: nil, description: nil, **opts) ⇒ BaseOptions

Returns a new instance of BaseOptions.



11
12
13
14
15
16
# File 'lib/view_component/storybook/controls/base_options.rb', line 11

def initialize(param, type:, options:, default: nil, labels: nil, name: nil, description: nil, **opts)
  super(param, default: default, name: name, description: description, **opts)
  @type = type
  @options = options
  @labels = labels
end

Instance Attribute Details

#labelsObject (readonly)

Returns the value of attribute labels.



7
8
9
# File 'lib/view_component/storybook/controls/base_options.rb', line 7

def labels
  @labels
end

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/view_component/storybook/controls/base_options.rb', line 7

def options
  @options
end

#typeObject (readonly)

Returns the value of attribute type.



7
8
9
# File 'lib/view_component/storybook/controls/base_options.rb', line 7

def type
  @type
end

Instance Method Details

#to_csf_paramsObject



18
19
20
# File 'lib/view_component/storybook/controls/base_options.rb', line 18

def to_csf_params
  super.deep_merge(argTypes: { param => { options: options } })
end