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 {|@builder| ... } ⇒ Navigation
constructor
A new instance of Navigation.
Constructor Details
#initialize {|@builder| ... } ⇒ Navigation
Returns a new instance of Navigation.
5 6 7 8 |
# File 'lib/super/navigation.rb', line 5 def initialize @builder = Builder.new yield @builder end |
Instance Method Details
#definition ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/super/navigation.rb', line 10 def definition return @definition if instance_variable_defined?(:@definition) 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 = validate_and_determine_explicit_links(@builder.build, unused_matches) @definition = (defs, all_matches, unused_matches.keys) end |