Class: ActionDispatch::Routing::HtmlTableFormatter
- Inherits:
-
Object
- Object
- ActionDispatch::Routing::HtmlTableFormatter
- Defined in:
- lib/action_dispatch/routing/inspector.rb
Instance Method Summary collapse
-
#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.
286 287 288 289 |
# File 'lib/action_dispatch/routing/inspector.rb', line 286 def initialize(view) @view = view @buffer = [] end |
Instance Method Details
#header(routes) ⇒ Object
The header is part of the HTML page, so we don’t construct it here.
300 301 |
# File 'lib/action_dispatch/routing/inspector.rb', line 300 def header(routes) end |
#no_routes ⇒ Object
303 304 305 306 307 308 309 310 311 312 313 314 |
# File 'lib/action_dispatch/routing/inspector.rb', line 303 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
316 317 318 319 320 |
# File 'lib/action_dispatch/routing/inspector.rb', line 316 def result @view.raw @view.render(layout: "routes/table") { @view.raw @buffer.join("\n") } end |
#section(routes) ⇒ Object
295 296 297 |
# File 'lib/action_dispatch/routing/inspector.rb', line 295 def section(routes) @buffer << @view.render(partial: "routes/route", collection: routes) end |
#section_title(title) ⇒ Object
291 292 293 |
# File 'lib/action_dispatch/routing/inspector.rb', line 291 def section_title(title) @buffer << %(<tr><th colspan="5">#{title}</th></tr>) end |