方法
类公共方法
new(view) 链接
来源:显示 | 在 GitHub 上
# File actionpack/lib/action_dispatch/routing/inspector.rb, line 284 def initialize(view) @view = view @buffer = [] end
实例公共方法
header(routes) 链接
页眉是 HTML 页面的一部分,因此我们不会在此处构造它。
来源:显示 | 在 GitHub 上
# File actionpack/lib/action_dispatch/routing/inspector.rb, line 298 def header(routes) end
no_routes(*) 链接
来源:显示 | 在 GitHub 上
# File actionpack/lib/action_dispatch/routing/inspector.rb, line 301 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.net.cn/routing.html">Rails Routing from the Outside In</a>. </li> </ul> MESSAGE end
result() 链接
来源:显示 | 在 GitHub 上
# File actionpack/lib/action_dispatch/routing/inspector.rb, line 314 def result @view.raw @view.render(layout: "routes/table") { @view.raw @buffer.join("\n") } end
section(routes) 链接
来源:显示 | 在 GitHub 上
# File actionpack/lib/action_dispatch/routing/inspector.rb, line 293 def section(routes) @buffer << @view.render(partial: "routes/route", collection: routes) end
section_title(title) 链接
来源:显示 | 在 GitHub 上
# File actionpack/lib/action_dispatch/routing/inspector.rb, line 289 def section_title(title) @buffer << %(<tr><th colspan="4">#{title}</th></tr>) end