class Voom::Presenters::DSL::Components::Header

Constants

VALID_PLACEMENTS

Attributes

image[RW]
placement[RW]
title[RW]

Public Class Methods

new(**attribs_, &block) click to toggle source
# File lib/voom/presenters/dsl/components/header.rb, line 10
def initialize(**attribs_, &block)
  super(type: :header,
        **attribs_, &block)
  self.title(attribs.delete(:title)) if attribs.key?(:title)
  @image = attribs.delete(:image)
  @placement = validate_placement(attribs.delete(:placement) { :static })
  expand!
end

Public Instance Methods

button(icon=nil, **attributes, &block) click to toggle source
# File lib/voom/presenters/dsl/components/header.rb, line 19
def button(icon=nil, **attributes, &block)
  return @button if locked?
  @button = Components::Button.new(icon: icon, parent: self, **attributes, &block)
end
menu(**attribs, &block) click to toggle source
nav(**attribs, &block) click to toggle source

Private Instance Methods

validate_placement(value) click to toggle source
# File lib/voom/presenters/dsl/components/header.rb, line 43
def validate_placement(value)
  return unless value

  placement = value.to_sym

  unless VALID_PLACEMENTS.include?(placement)
    raise Errors::ParameterValidation, "Invalid placement specified: #{placement}"
  end

  placement
end