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.
203 204 205 206 |
# File 'lib/action_dispatch/routing/inspector.rb', line 203 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.
217 218 |
# File 'lib/action_dispatch/routing/inspector.rb', line 217 def header(routes) end |
#no_routes ⇒ Object
220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/action_dispatch/routing/inspector.rb', line 220 def no_routes @buffer << " <p>You don't have any routes defined!</p>\n <ul>\n <li>Please add some routes in <tt>config/routes.rb</tt>.</li>\n <li>\n For more information about routes, please see the Rails guide\n <a href=\"http://guides.rubyonrails.org/routing.html\">Rails Routing from the Outside In</a>.\n </li>\n </ul>\n MESSAGE\nend\n".strip_heredoc |
#result ⇒ Object
233 234 235 236 237 |
# File 'lib/action_dispatch/routing/inspector.rb', line 233 def result @view.raw @view.render(layout: "routes/table") { @view.raw @buffer.join("\n") } end |
#section(routes) ⇒ Object
212 213 214 |
# File 'lib/action_dispatch/routing/inspector.rb', line 212 def section(routes) @buffer << @view.render(partial: "routes/route", collection: routes) end |
#section_title(title) ⇒ Object
208 209 210 |
# File 'lib/action_dispatch/routing/inspector.rb', line 208 def section_title(title) @buffer << %(<tr><th colspan="4">#{title}</th></tr>) end |