123456789_123456789_123456789_123456789_123456789_

Class: ActionDispatch::Routing::HtmlTableFormatter

Relationships & Source Files
Inherits: Object
Defined in: actionpack/lib/action_dispatch/routing/inspector.rb

Class Method Summary

Instance Method Summary

Constructor Details

.new(view) ⇒ HtmlTableFormatter

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/inspector.rb', line 197

def initialize(view)
  @view = view
  @buffer = []
end

Instance Method Details

#header(routes)

the header is part of the HTML page, so we don't construct it here.

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/inspector.rb', line 211

def header(routes)
end

#no_routes

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/inspector.rb', line 214

def no_routes
  @buffer << <<-MESSAGE.strip_heredoc
    <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="http://guides.rubyonrails.org/routing.html">Rails Routing from the Outside In</a>.
      </li>
    </ul>
    MESSAGE
end

#result

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/inspector.rb', line 227

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 206

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 202

def section_title(title)
  @buffer << %(<tr><th colspan="4">#{title}</th></tr>)
end