Class: Super::Navigation::RouteFormatterButReallySearcher
- Inherits:
-
Object
- Object
- Super::Navigation::RouteFormatterButReallySearcher
- Defined in:
- lib/super/navigation.rb
Instance Method Summary collapse
- #header(routes) ⇒ Object
-
#initialize(route_namespace: Super.configuration.path) ⇒ RouteFormatterButReallySearcher
constructor
A new instance of RouteFormatterButReallySearcher.
- #matches ⇒ Object
- #no_routes(routes, filter) ⇒ Object
- #result ⇒ Object
- #section(routes) ⇒ Object
- #section_title(title) ⇒ Object
Constructor Details
#initialize(route_namespace: Super.configuration.path) ⇒ RouteFormatterButReallySearcher
Returns a new instance of RouteFormatterButReallySearcher.
132 133 134 135 136 |
# File 'lib/super/navigation.rb', line 132 def initialize(route_namespace: Super.configuration.path) @route_namespace = route_namespace.strip.gsub(%r{\A/+}, "").gsub(%r{/+\z}, "").strip @route_namespace = "/#{@route_namespace}/" @matches = [] end |
Instance Method Details
#header(routes) ⇒ Object
155 156 |
# File 'lib/super/navigation.rb', line 155 def header(routes) end |
#matches ⇒ Object
138 139 140 141 142 |
# File 'lib/super/navigation.rb', line 138 def matches @matches.map do |route| route[:path].sub(/\(.*\)\Z/, "") end end |
#no_routes(routes, filter) ⇒ Object
158 159 |
# File 'lib/super/navigation.rb', line 158 def no_routes(routes, filter) end |
#result ⇒ Object
161 162 |
# File 'lib/super/navigation.rb', line 161 def result end |
#section(routes) ⇒ Object
144 145 146 147 148 149 150 151 152 153 |
# File 'lib/super/navigation.rb', line 144 def section(routes) @matches += routes.select do |route| next false unless route[:verb] == "GET" || route[:verb] == "" next false unless route[:path].start_with?(@route_namespace) next false if route[:path].include?("/:") next false if route[:reqs].end_with?("#new") true end end |
#section_title(title) ⇒ Object
164 165 |
# File 'lib/super/navigation.rb', line 164 def section_title(title) end |