Class: Super::Navigation
- Inherits:
-
Object
- Object
- Super::Navigation
- Defined in:
- lib/super/navigation.rb
Defined Under Namespace
Classes: Builder, Menu, RouteFormatterButReallySearcher
Instance Method Summary collapse
- #definition ⇒ Object
-
#initialize ⇒ Navigation
constructor
A new instance of Navigation.
Constructor Details
#initialize ⇒ Navigation
Returns a new instance of Navigation.
5 6 7 8 9 10 11 |
# File 'lib/super/navigation.rb', line 5 def initialize @builder = Builder.new @definition = yield @builder if !@definition.is_a?(Array) @definition = [@definition] end end |
Instance Method Details
#definition ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/super/navigation.rb', line 13 def definition return @defs if instance_variable_defined?(:@defs) searcher = RouteFormatterButReallySearcher.new inspector = ActionDispatch::Routing::RoutesInspector.new(Rails.application.routes.routes) inspector.format(searcher) all_matches = searcher.matches unused_matches = all_matches.each_with_object({}) { |match, hash| hash[match] = true } defs = (@definition) defs = validate_and_determine_explicit_links(defs, unused_matches) @defs = (defs, all_matches, unused_matches.keys) end |