class ActionDispatch::Routing::ConsoleFormatter::Expanded

Public Instance Methods

section(routes) click to toggle source
# File lib/action_dispatch/routing/inspector.rb, line 207
def section(routes)
  @buffer << draw_expanded_section(routes)
end
section_title(title) click to toggle source
# File lib/action_dispatch/routing/inspector.rb, line 203
def section_title(title)
  @buffer << "\n#{"[ #{title} ]"}"
end

Private Instance Methods

draw_expanded_section(routes) click to toggle source
# File lib/action_dispatch/routing/inspector.rb, line 212
          def draw_expanded_section(routes)
            routes.map.each_with_index do |r, i|
              <<~MESSAGE.chomp
                #{route_header(index: i + 1)}
                Prefix            | #{r[:name]}
                Verb              | #{r[:verb]}
                URI               | #{r[:path]}
                Controller#Action | #{r[:reqs]}
              MESSAGE
            end
          end
route_header(index:) click to toggle source
# File lib/action_dispatch/routing/inspector.rb, line 224
def route_header(index:)
  console_width = IO.console_size.second
  header_prefix = "--[ Route #{index} ]"
  dash_remainder = [console_width - header_prefix.size, 0].max

  "#{header_prefix}#{'-' * dash_remainder}"
end