Class: Voom::Presenters::DSL::Components::Menu::Item

Inherits:
EventBase
  • Object
show all
Includes:
Voom::Presenters::DSL::Components::Mixins::Tooltips
Defined in:
lib/voom/presenters/dsl/components/menu.rb

Instance Attribute Summary collapse

Attributes inherited from EventBase

#event_parent_id

Attributes included from Voom::Presenters::DSL::Components::Mixins::Event

#events

Attributes inherited from Base

#attributes, #context, #id, #type

Instance Method Summary collapse

Methods included from Voom::Presenters::DSL::Components::Mixins::Tooltips

#tooltip

Methods included from Voom::Presenters::DSL::Components::Mixins::Event

#event

Methods inherited from Base

#expand!

Methods included from Voom::Presenters::DSL::Components::Mixins::YieldTo

#yield_to

Methods included from Serializer

#to_hash

Methods included from Lockable

#lock!, #locked?

Constructor Details

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

Returns a new instance of Item.



41
42
43
44
45
46
# File 'lib/voom/presenters/dsl/components/menu.rb', line 41

def initialize(**attribs_, &block)
  super(type: :item, **attribs_, &block)
  @text = attribs.delete(:text)
  @disabled = attribs.delete(:disabled)
  expand!
end

Instance Attribute Details

#disabledObject

Returns the value of attribute disabled.



39
40
41
# File 'lib/voom/presenters/dsl/components/menu.rb', line 39

def disabled
  @disabled
end

#textObject

Returns the value of attribute text.



39
40
41
# File 'lib/voom/presenters/dsl/components/menu.rb', line 39

def text
  @text
end

Instance Method Details

#icon(icon = nil, **attribs, &block) ⇒ Object



48
49
50
51
52
53
# File 'lib/voom/presenters/dsl/components/menu.rb', line 48

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