Class: ViewComponent::Storybook::Slots::Slot

Inherits:
Object
  • Object
show all
Defined in:
lib/view_component/storybook/slots/slot.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#componentObject (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_blockObject (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_argsObject (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_nameObject (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