Class: SimplerNavigation::Renderers::Base
- Inherits:
-
Object
- Object
- SimplerNavigation::Renderers::Base
- Includes:
- ActionView::Helpers::OutputSafetyHelper, ActionView::Helpers::TagHelper, ActionView::Helpers::UrlHelper
- Defined in:
- lib/simpler_navigation/renderers/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#item ⇒ Object
readonly
Returns the value of attribute item.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(context, item, options = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(context, item, options = {}) ⇒ Base
Returns a new instance of Base.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/simpler_navigation/renderers/base.rb', line 14 def initialize(context, item, = {}) @selected = {} @active_leaf = {} @show = {} @context = context @item = item @options = @options[:level] ||= :all @request_fullpath = context.request.fullpath if @options[:request_fullpath] @request_fullpath = @options[:request_fullpath] end if @item.nil? case @options[:level] when :all @item = SimplerNavigation.config.root_item when Integer @item = find_parent_item_for_level(SimplerNavigation.config.root_item, @options[:level]) when Range @item = find_parent_item_for_level(SimplerNavigation.config.root_item, @options[:level].min) else raise Error, "Invalid navigation level: #{@options[:level]}" end end end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
10 11 12 |
# File 'lib/simpler_navigation/renderers/base.rb', line 10 def context @context end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
11 12 13 |
# File 'lib/simpler_navigation/renderers/base.rb', line 11 def item @item end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
12 13 14 |
# File 'lib/simpler_navigation/renderers/base.rb', line 12 def @options end |