Class: Satis::Menus::Menu

Inherits:
Object
  • Object
show all
Defined in:
lib/satis/menus/menu.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args, **kwargs) {|_self| ... } ⇒ Menu

Returns a new instance of Menu.

Yields:

  • (_self)

Yield Parameters:



7
8
9
10
11
12
13
14
15
# File 'lib/satis/menus/menu.rb', line 7

def initialize(*args, **kwargs)
  @options = args.extract_options!
  @items = []
  @scope = Array.wrap(args.first)
  @level = kwargs[:level] || 0
  @event = kwargs[:event] || "mouseover"
  @show_scroll = kwargs[:show_scroll] || false
  yield self if block_given?
end

Instance Attribute Details

#eventObject (readonly)

Returns the value of attribute event.



6
7
8
# File 'lib/satis/menus/menu.rb', line 6

def event
  @event
end

#itemsObject (readonly)

Returns the value of attribute items.



6
7
8
# File 'lib/satis/menus/menu.rb', line 6

def items
  @items
end

#levelObject (readonly)

Returns the value of attribute level.



6
7
8
# File 'lib/satis/menus/menu.rb', line 6

def level
  @level
end

#show_scrollObject (readonly)

Returns the value of attribute show_scroll.



6
7
8
# File 'lib/satis/menus/menu.rb', line 6

def show_scroll
  @show_scroll
end

Instance Method Details

#item(*args, **kwargs, &block) ⇒ Object



17
18
19
20
21
# File 'lib/satis/menus/menu.rb', line 17

def item(*args, **kwargs, &block)
  kwargs[:scope] = @scope
  kwargs[:level] = @level
  @items << Item.new(*args, **kwargs, &block)
end