Class: Voom::Presenters::DSL::Components::Header

Inherits:
Base
  • Object
show all
Defined in:
lib/voom/presenters/dsl/components/header.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#attributes, #context, #id, #type

Instance Method Summary collapse

Methods inherited from Base

#expand!

Methods included from Serializer

#to_hash

Methods included from Lockable

#lock!, #locked?

Constructor Details

#initialize(**attribs_, &block) ⇒ Header

Returns a new instance of Header.



8
9
10
11
12
13
14
15
# File 'lib/voom/presenters/dsl/components/header.rb', line 8

def initialize(**attribs_, &block)
  super(type: :header,
        context: context,
        **attribs_, &block)
  self.title(attribs.delete(:title)) if attribs.key?(:title)
  @image = attribs.delete(:image)
  expand!
end

Instance Attribute Details

#imageObject

Returns the value of attribute image.



6
7
8
# File 'lib/voom/presenters/dsl/components/header.rb', line 6

def image
  @image
end

#title(*text, **attribs, &block) ⇒ Object

Returns the value of attribute title.



6
7
8
# File 'lib/voom/presenters/dsl/components/header.rb', line 6

def title
  @title
end

Instance Method Details



17
18
19
20
21
22
# File 'lib/voom/presenters/dsl/components/header.rb', line 17

def menu(**attribs, &block)
  return @menu if locked?
  @menu = Menu.new(parent: self,
                   context: context,
                   **attribs, &block)
end