Class: Voom::Presenters::DSL::Components::Menu
- Defined in:
- lib/voom/presenters/dsl/components/menu.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#items ⇒ Object
Returns the value of attribute items.
-
#open ⇒ Object
Returns the value of attribute open.
-
#position ⇒ Object
Returns the value of attribute position.
-
#title ⇒ Object
Returns the value of attribute title.
Attributes inherited from Base
#attributes, #context, #id, #type
Instance Method Summary collapse
- #divider(**attribs, &block) ⇒ Object
-
#initialize(title = nil, **attribs_, &block) ⇒ Menu
constructor
A new instance of Menu.
- #item(first_text = nil, text: nil, **attribs, &block) ⇒ Object
Methods inherited from Base
Methods included from Serializer
Methods included from Lockable
Constructor Details
#initialize(title = nil, **attribs_, &block) ⇒ Menu
Returns a new instance of Menu.
11 12 13 14 15 16 17 18 19 |
# File 'lib/voom/presenters/dsl/components/menu.rb', line 11 def initialize(title=nil, **attribs_, &block) super(type: :menu, **attribs_, &block) @title = title @items = [] @position = attribs.delete(:position) || :left @color = attribs.delete(:color) @open = attributes.delete(:open){false} end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
9 10 11 |
# File 'lib/voom/presenters/dsl/components/menu.rb', line 9 def color @color end |
#items ⇒ Object
Returns the value of attribute items.
9 10 11 |
# File 'lib/voom/presenters/dsl/components/menu.rb', line 9 def items @items end |
#open ⇒ Object
Returns the value of attribute open.
9 10 11 |
# File 'lib/voom/presenters/dsl/components/menu.rb', line 9 def open @open end |
#position ⇒ Object
Returns the value of attribute position.
9 10 11 |
# File 'lib/voom/presenters/dsl/components/menu.rb', line 9 def position @position end |
#title ⇒ Object
Returns the value of attribute title.
9 10 11 |
# File 'lib/voom/presenters/dsl/components/menu.rb', line 9 def title @title end |
Instance Method Details
#divider(**attribs, &block) ⇒ Object
28 29 30 31 32 |
# File 'lib/voom/presenters/dsl/components/menu.rb', line 28 def divider(**attribs, &block) @items << Divider.new(parent: self, context: context, **attribs, &block) end |
#item(first_text = nil, text: nil, **attribs, &block) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/voom/presenters/dsl/components/menu.rb', line 21 def item(first_text = nil, text: nil, **attribs, &block) the_text = first_text || text @items << Item.new(parent: self, text: the_text, context: context, **attribs, &block) end |