Class: SemanticNavigation::Core::Leaf

Inherits:
Base
  • Object
show all
Includes:
MixIn::ConditionMethods, MixIn::NameMethods, MixIn::UrlMethods
Defined in:
lib/semantic_navigation/core/leaf.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#active, #classes, #html, #id, #level, #render_if

Instance Method Summary collapse

Methods included from MixIn::ConditionMethods

#skip?, #skip_for_renderer

Methods included from MixIn::NameMethods

#name

Methods included from MixIn::UrlMethods

#url

Methods inherited from Base

#render

Constructor Details

#initialize(options, level) ⇒ Leaf

Returns a new instance of Leaf.



10
11
12
13
# File 'lib/semantic_navigation/core/leaf.rb', line 10

def initialize(options, level)
  @link_html = {}
  super options, level
end

Instance Attribute Details

Returns the value of attribute link_classes.



8
9
10
# File 'lib/semantic_navigation/core/leaf.rb', line 8

def link_classes
  @link_classes
end

Returns the value of attribute link_html.



8
9
10
# File 'lib/semantic_navigation/core/leaf.rb', line 8

def link_html
  @link_html
end

Instance Method Details

#mark_activeObject



15
16
17
18
19
20
21
# File 'lib/semantic_navigation/core/leaf.rb', line 15

def mark_active
  if @url
    @active = urls.map{|u| current_page?(u) rescue false}.reduce(:"|")
  else
    @active = false
  end
end