Class: Super::Navigation::RouteFormatterButReallySearcher

Inherits:
Object
  • Object
show all
Defined in:
lib/super/navigation.rb

Instance Method Summary collapse

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

#matchesObject



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

#resultObject



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