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.



135
136
137
138
139
# File 'lib/super/navigation.rb', line 135

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



158
# File 'lib/super/navigation.rb', line 158

def header(routes); end

#matchesObject



141
142
143
144
145
# File 'lib/super/navigation.rb', line 141

def matches
  @matches.map do |route|
    route[:path].sub(/\(.*\)\Z/, "")
  end
end

#no_routes(routes, filter) ⇒ Object



159
# File 'lib/super/navigation.rb', line 159

def no_routes(routes, filter); end

#resultObject



160
# File 'lib/super/navigation.rb', line 160

def result; end

#section(routes) ⇒ Object



147
148
149
150
151
152
153
154
155
156
# File 'lib/super/navigation.rb', line 147

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



161
# File 'lib/super/navigation.rb', line 161

def section_title(title); end