Class: SemanticMenu

Inherits:
MenuItem show all
Defined in:
lib/semantic_menu.rb

Instance Attribute Summary

Attributes inherited from MenuItem

#children, #link

Instance Method Summary (collapse)

Methods inherited from MenuItem

#active?, #add, #child_output, #level_class, #on_current_page?

Constructor Details

- (SemanticMenu) initialize(controller, opts = {}) {|_self| ... }

Returns a new instance of SemanticMenu

Yields:

  • (_self)

Yield Parameters:

  • _self (SemanticMenu)

    the object that the method was called on



48
49
50
51
52
53
54
55
# File 'lib/semantic_menu.rb', line 48

def initialize(controller, opts={},&block)
 @@controller = controller
  @opts       = {:class => 'menu'}.merge opts
  @level      = 0
  @children   = []
  
  yield self if block_given?
end

Instance Method Details

- (Object) to_s



57
58
59
# File 'lib/semantic_menu.rb', line 57

def to_s
  (:ul, @children.collect(&:to_s).join, @opts)
end