Class: ActionDispatch::Routing::HtmlTableFormatter
- Inherits:
-
Object
- Object
- ActionDispatch::Routing::HtmlTableFormatter
- Defined in:
- lib/action_dispatch/routing/inspector.rb
Instance Method Summary collapse
- #footer(routes) ⇒ Object
-
#header(routes) ⇒ Object
The header is part of the HTML page, so we don’t construct it here.
-
#initialize(view) ⇒ HtmlTableFormatter
constructor
A new instance of HtmlTableFormatter.
- #no_routes ⇒ Object
- #result ⇒ Object
- #section(routes) ⇒ Object
- #section_title(title) ⇒ Object
Constructor Details
#initialize(view) ⇒ HtmlTableFormatter
Returns a new instance of HtmlTableFormatter.
306 307 308 309 |
# File 'lib/action_dispatch/routing/inspector.rb', line 306 def initialize(view) @view = view @buffer = [] end |
Instance Method Details
#footer(routes) ⇒ Object
323 324 |
# File 'lib/action_dispatch/routing/inspector.rb', line 323 def (routes) end |
#header(routes) ⇒ Object
The header is part of the HTML page, so we don’t construct it here.
320 321 |
# File 'lib/action_dispatch/routing/inspector.rb', line 320 def header(routes) end |
#no_routes ⇒ Object
326 327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/action_dispatch/routing/inspector.rb', line 326 def no_routes(*) @buffer << <<~MESSAGE <p>You don't have any routes defined!</p> <ul> <li>Please add some routes in <tt>config/routes.rb</tt>.</li> <li> For more information about routes, please see the Rails guide <a href="https://guides.rubyonrails.org/routing.html">Rails Routing from the Outside In</a>. </li> </ul> MESSAGE end |
#result ⇒ Object
339 340 341 342 343 |
# File 'lib/action_dispatch/routing/inspector.rb', line 339 def result @view.raw @view.render(layout: "routes/table") { @view.raw @buffer.join("\n") } end |
#section(routes) ⇒ Object
315 316 317 |
# File 'lib/action_dispatch/routing/inspector.rb', line 315 def section(routes) @buffer << @view.render(partial: "routes/route", collection: routes) end |
#section_title(title) ⇒ Object
311 312 313 |
# File 'lib/action_dispatch/routing/inspector.rb', line 311 def section_title(title) @buffer << %(<tr><th colspan="5">#{title}</th></tr>) end |