class Routler::StatBuilder

Attributes

parser[RW]

Public Class Methods

new(parser) click to toggle source
# File lib/routler/stat_builder.rb, line 6
def initialize(parser)
  @parser = parser
end

Public Instance Methods

display() click to toggle source
# File lib/routler/stat_builder.rb, line 10
def display
  controllers = @parser.all_controllers
  num_actions = controllers.inject(0) {|sum, c| sum + c.actions.length}
  output =  "            Stats:\n"
  output += "=============================\n"
  output += "Controllers found: #{controllers.length}\n"
  output += "    Actions found: #{num_actions}\n"
  output += "     Lines parsed: #{@parser.lines}\n"
  output += "   Parsing errors: #{@parser.error_lines.length}\n"
  output += "=============================\n"
  output += "Parsing error on the following lines:\n"
  @parser.error_lines.each {|e| output += "#{e}"}
  output
end