123456789_123456789_123456789_123456789_123456789_

Class: ActionDispatch::Routing::ConsoleFormatter::Sheet

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
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

This class inherits a constructor from ActionDispatch::Routing::ConsoleFormatter::Base

Instance Method Details

#draw_header(routes) (private)

[ GitHub ]

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

def draw_header(routes)
  name_width, verb_width, path_width = widths(routes)

  "#{"Prefix".rjust(name_width)} #{"Verb".ljust(verb_width)} #{"URI Pattern".ljust(path_width)} Controller#Action"
end

#draw_section(routes) (private)

[ GitHub ]

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

def draw_section(routes)
  header_lengths = ["Prefix", "Verb", "URI Pattern"].map(&:length)
  name_width, verb_width, path_width = widths(routes).zip(header_lengths).map(&:max)

  routes.map do |r|
    "#{r[:name].rjust(name_width)} #{r[:verb].ljust(verb_width)} #{r[:path].ljust(path_width)} #{r[:reqs]}"
  end
end

#header(routes)

[ GitHub ]

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

def header(routes)
  @buffer << draw_header(routes)
end

#section(routes)

[ GitHub ]

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

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

#section_title(title)

[ GitHub ]

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

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

#widths(routes) (private)

[ GitHub ]

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

def widths(routes)
  [routes.map { |r| r[:name].length }.max || 0,
   routes.map { |r| r[:verb].length }.max || 0,
   routes.map { |r| r[:path].length }.max || 0]
end