Class: ViewComponent::Storybook::Slots::Slot
- Inherits:
-
Object
- Object
- ViewComponent::Storybook::Slots::Slot
- Defined in:
- lib/view_component/storybook/slots/slot.rb
Instance Attribute Summary collapse
-
#component ⇒ Object
readonly
Returns the value of attribute component.
-
#content_block ⇒ Object
readonly
Returns the value of attribute content_block.
-
#slot_method_args ⇒ Object
readonly
Returns the value of attribute slot_method_args.
-
#slot_name ⇒ Object
readonly
Returns the value of attribute slot_name.
Instance Method Summary collapse
- #call(&block) ⇒ Object
-
#initialize(component, slot_name, slot_method_args, content_block) ⇒ Slot
constructor
delegate :args, :kwargs, :controls, to: :slot_method_args.
Constructor Details
#initialize(component, slot_name, slot_method_args, content_block) ⇒ Slot
delegate :args, :kwargs, :controls, to: :slot_method_args
11 12 13 14 15 16 |
# File 'lib/view_component/storybook/slots/slot.rb', line 11 def initialize(component, slot_name, slot_method_args, content_block) @component = component @slot_name = slot_name @slot_method_args = slot_method_args @content_block = content_block end |
Instance Attribute Details
#component ⇒ Object (readonly)
Returns the value of attribute component.
7 8 9 |
# File 'lib/view_component/storybook/slots/slot.rb', line 7 def component @component end |
#content_block ⇒ Object (readonly)
Returns the value of attribute content_block.
7 8 9 |
# File 'lib/view_component/storybook/slots/slot.rb', line 7 def content_block @content_block end |
#slot_method_args ⇒ Object (readonly)
Returns the value of attribute slot_method_args.
7 8 9 |
# File 'lib/view_component/storybook/slots/slot.rb', line 7 def slot_method_args @slot_method_args end |
#slot_name ⇒ Object (readonly)
Returns the value of attribute slot_name.
7 8 9 |
# File 'lib/view_component/storybook/slots/slot.rb', line 7 def slot_name @slot_name end |
Instance Method Details
#call(&block) ⇒ Object
18 19 20 |
# File 'lib/view_component/storybook/slots/slot.rb', line 18 def call(&block) component.send("with_#{slot_name}", *slot_method_args.args, **slot_method_args.kwargs, &block) end |