Class: ViewComponent::Storybook::Story
- Inherits:
-
Object
- Object
- ViewComponent::Storybook::Story
- Defined in:
- lib/view_component/storybook/story.rb
Instance Attribute Summary collapse
-
#controls ⇒ Object
readonly
Returns the value of attribute controls.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
Instance Method Summary collapse
-
#initialize(id, name, parameters, controls) ⇒ Story
constructor
A new instance of Story.
- #to_csf_params ⇒ Object
Constructor Details
#initialize(id, name, parameters, controls) ⇒ Story
Returns a new instance of Story.
8 9 10 11 12 13 |
# File 'lib/view_component/storybook/story.rb', line 8 def initialize(id, name, parameters, controls) @id = id @name = name @parameters = parameters @controls = controls end |
Instance Attribute Details
#controls ⇒ Object (readonly)
Returns the value of attribute controls.
6 7 8 |
# File 'lib/view_component/storybook/story.rb', line 6 def controls @controls end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/view_component/storybook/story.rb', line 6 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/view_component/storybook/story.rb', line 6 def name @name end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
6 7 8 |
# File 'lib/view_component/storybook/story.rb', line 6 def parameters @parameters end |
Instance Method Details
#to_csf_params ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/view_component/storybook/story.rb', line 15 def to_csf_params csf_params = { name: name, parameters: { server: { id: id } } } csf_params.deep_merge!(parameters: parameters) if parameters.present? controls.each do |control| csf_params.deep_merge!(control.to_csf_params) end csf_params end |