Class: SemanticNavigation::Core::Node
- Defined in:
- lib/semantic_navigation/core/node.rb
Instance Attribute Summary collapse
-
#link_classes ⇒ Object
Returns the value of attribute link_classes.
-
#link_html ⇒ Object
Returns the value of attribute link_html.
-
#node_classes ⇒ Object
Returns the value of attribute node_classes.
-
#node_html ⇒ Object
Returns the value of attribute node_html.
-
#sub_elements ⇒ Object
Returns the value of attribute sub_elements.
Attributes inherited from Base
#active, #classes, #html, #id, #level, #render_if
Instance Method Summary collapse
-
#initialize(options, level) ⇒ Node
constructor
A new instance of Node.
- #mark_active ⇒ Object
Methods included from MixIn::ConditionMethods
Methods included from MixIn::DslMethods
#divider, #header, #item, #method_missing, #scope
Methods included from MixIn::NameMethods
Methods included from MixIn::UrlMethods
Methods inherited from Base
Constructor Details
#initialize(options, level) ⇒ Node
Returns a new instance of Node.
12 13 14 15 16 17 18 19 |
# File 'lib/semantic_navigation/core/node.rb', line 12 def initialize(, level) @url = [] @link_html = {} @node_html = {} @scope_options = {} @sub_elements = [] super , level end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class SemanticNavigation::Core::MixIn::DslMethods
Instance Attribute Details
#link_classes ⇒ Object
Returns the value of attribute link_classes.
9 10 11 |
# File 'lib/semantic_navigation/core/node.rb', line 9 def link_classes @link_classes end |
#link_html ⇒ Object
Returns the value of attribute link_html.
9 10 11 |
# File 'lib/semantic_navigation/core/node.rb', line 9 def link_html @link_html end |
#node_classes ⇒ Object
Returns the value of attribute node_classes.
9 10 11 |
# File 'lib/semantic_navigation/core/node.rb', line 9 def node_classes @node_classes end |
#node_html ⇒ Object
Returns the value of attribute node_html.
9 10 11 |
# File 'lib/semantic_navigation/core/node.rb', line 9 def node_html @node_html end |
#sub_elements ⇒ Object
Returns the value of attribute sub_elements.
9 10 11 |
# File 'lib/semantic_navigation/core/node.rb', line 9 def sub_elements @sub_elements end |
Instance Method Details
#mark_active ⇒ Object
21 22 23 24 25 |
# File 'lib/semantic_navigation/core/node.rb', line 21 def mark_active @sub_elements.each{|element| element.mark_active} @active = urls.map{|u| current_page?(u) rescue false}.reduce(:"|") @active |= !@sub_elements.find{|element| element.active}.nil? end |