Class: ViewComponent::Storybook::Controls::Control

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/view_component/storybook/controls/control.rb

Direct Known Subclasses

SimpleControl

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(param, default:, name: nil, description: nil) ⇒ Control

Returns a new instance of Control.



13
14
15
16
17
18
# File 'lib/view_component/storybook/controls/control.rb', line 13

def initialize(param, default:, name: nil, description: nil)
  @param = param
  @default = default
  @name = name || param.to_s.humanize.titlecase
  @description = description
end

Instance Attribute Details

#defaultObject (readonly)

Returns the value of attribute default.



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

def default
  @default
end

#descriptionObject (readonly)

Returns the value of attribute description.



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

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#paramObject (readonly)

Returns the value of attribute param.



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

def param
  @param
end

Instance Method Details

#parse_param_value(value) ⇒ Object

Raises:

  • (NotImplementedError)


26
27
28
29
30
# File 'lib/view_component/storybook/controls/control.rb', line 26

def parse_param_value(value)
  # :nocov:
  raise NotImplementedError
  # :nocov:
end

#to_csf_paramsObject

Raises:

  • (NotImplementedError)


20
21
22
23
24
# File 'lib/view_component/storybook/controls/control.rb', line 20

def to_csf_params
  # :nocov:
  raise NotImplementedError
  # :nocov:
end