Class: SemanticNavigation::Core::Base
- Inherits:
-
Object
- Object
- SemanticNavigation::Core::Base
- Defined in:
- lib/semantic_navigation/core/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#active ⇒ Object
Returns the value of attribute active.
-
#classes ⇒ Object
Returns the value of attribute classes.
-
#html ⇒ Object
Returns the value of attribute html.
-
#id ⇒ Object
Returns the value of attribute id.
-
#level ⇒ Object
Returns the value of attribute level.
- #render_if ⇒ Object
Instance Method Summary collapse
-
#initialize(options, level) ⇒ Base
constructor
A new instance of Base.
- #render(renderer) ⇒ Object
Constructor Details
#initialize(options, level) ⇒ Base
Returns a new instance of Base.
18 19 20 21 22 23 24 |
# File 'lib/semantic_navigation/core/base.rb', line 18 def initialize(, level) @level = level @html = {} .keys.each do |option_name| instance_variable_set :"@#{option_name}", [option_name] end end |
Instance Attribute Details
#active ⇒ Object
Returns the value of attribute active.
5 6 7 |
# File 'lib/semantic_navigation/core/base.rb', line 5 def active @active end |
#classes ⇒ Object
Returns the value of attribute classes.
5 6 7 |
# File 'lib/semantic_navigation/core/base.rb', line 5 def classes @classes end |
#html ⇒ Object
Returns the value of attribute html.
5 6 7 |
# File 'lib/semantic_navigation/core/base.rb', line 5 def html @html end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/semantic_navigation/core/base.rb', line 5 def id @id end |
#level ⇒ Object
Returns the value of attribute level.
5 6 7 |
# File 'lib/semantic_navigation/core/base.rb', line 5 def level @level end |
#render_if ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/semantic_navigation/core/base.rb', line 8 def render_if unless @render_if.nil? @render_if.map do |bl| view_object.instance_exec(self, &bl) end.all? else true end end |
Instance Method Details
#render(renderer) ⇒ Object
26 27 28 29 |
# File 'lib/semantic_navigation/core/base.rb', line 26 def render(renderer) class_name = self.class.name.split('::').last.downcase renderer.send :"render_#{class_name}", self end |