module ViewComponent::Storybook::ContentConcern

Public Instance Methods

content(content = nil, &block) click to toggle source
# File lib/view_component/storybook/content_concern.rb, line 12
def content(content = nil, &block)
  case content
  when Storybook::Controls::ControlConfig
    @content_control = content.param(content_param)
    @content_block = nil
  when String
    @content_control = nil
    @content_block = proc { content }
  else
    @content_control = nil
    @content_block = block
  end
end
resolve_content_block(params) click to toggle source
# File lib/view_component/storybook/content_concern.rb, line 26
def resolve_content_block(params)
  if content_control
    content = content_control.value_from_params(params)
    proc { content }
  else
    content_block
  end
end

Private Instance Methods

content_param() click to toggle source
# File lib/view_component/storybook/content_concern.rb, line 37
def content_param
  :content
end