123456789_123456789_123456789_123456789_123456789_

Class: ActionDispatch::Routing::ConsoleFormatter::Expanded

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Base
Instance Chain:
self, Base
Inherits: ActionDispatch::Routing::ConsoleFormatter::Base
Defined in: actionpack/lib/action_dispatch/routing/inspector.rb

Class Method Summary

Base - Inherited

Instance Method Summary

Constructor Details

.new(width: ) ⇒ Expanded

[ GitHub ]

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

def initialize(width: IO.console_size[1])
  @width = width
  super()
end

Instance Method Details

#draw_expanded_section(routes) (private)

[ GitHub ]

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

def draw_expanded_section(routes)
  routes.map.each_with_index do |r, i|
    route_rows = <<~MESSAGE.chomp
      #{route_header(index: i + 1)}
      Prefix            | #{r[:name]}
      Verb              | #{r[:verb]}
      URI               | #{r[:path]}
      Controller#Action | #{r[:reqs]}
    MESSAGE
    source_location = "\nSource Location   | #{r[:source_location]}"
    route_rows += source_location if r[:source_location].present?
    route_rows
  end
end

#route_header(index:) (private)

[ GitHub ]

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

def route_header(index:)
  "--[ Route #{index} ]".ljust(@width, "-")
end

#section(routes)

[ GitHub ]

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

def section(routes)
  @buffer << draw_expanded_section(routes)
end

#section_title(title)

[ GitHub ]

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

def section_title(title)
  @buffer << "\n#{"[ #{title} ]"}"
end