Class: Footnotes::Notes::SinatraRoutesNote

Inherits:
AbstractNote show all
Defined in:
lib/sinatra-footnotes/notes/sinatra_routes_note.rb

Instance Method Summary collapse

Methods inherited from AbstractNote

close!, #has_fieldset?, included?, #javascript, #link, #onclick, #row, start!, #stylesheet, title, #to_sym, to_sym, #valid?

Constructor Details

#initialize(controller) ⇒ SinatraRoutesNote

Returns a new instance of SinatraRoutesNote.



6
7
8
9
# File 'lib/sinatra-footnotes/notes/sinatra_routes_note.rb', line 6

def initialize(controller)
  @controller = controller
  @parsed_routes = parse_routes(controller)
end

Instance Method Details

#contentObject



19
20
21
22
# File 'lib/sinatra-footnotes/notes/sinatra_routes_note.rb', line 19

def content
  #mount_table(@parsed_routes.unshift([:path, :name, :options, :requirements]), :summary => "Debug information for #{title}")
  mount_table(@parsed_routes.unshift([:method, :path]), :summary => "Debug information for #{title}")
end

#legendObject



15
16
17
# File 'lib/sinatra-footnotes/notes/sinatra_routes_note.rb', line 15

def legend
  'Routes'
end

#titleObject



11
12
13
# File 'lib/sinatra-footnotes/notes/sinatra_routes_note.rb', line 11

def title
  "Routes (#{@parsed_routes.size})" # don't show 'SinatraRoutes'
end