class BetterRoutes::Formatter::CsvFormatter

Public Class Methods

new() click to toggle source
# File lib/better_routes/formatter/csv_formatter.rb, line 4
def initialize
  @buffer = []
  @current_section = "Application"
end

Public Instance Methods

header(routes) click to toggle source
# File lib/better_routes/formatter/csv_formatter.rb, line 23
def header(routes)
  @buffer << "Prefix, Verb, URI Pattern, Controller#Action"
end
no_routes(routes) click to toggle source
# File lib/better_routes/formatter/csv_formatter.rb, line 28
def no_routes(routes)
  @buffer << ""
end
result() click to toggle source
# File lib/better_routes/formatter/csv_formatter.rb, line 9
def result
  @buffer.join("\n")
end
section(routes) click to toggle source
# File lib/better_routes/formatter/csv_formatter.rb, line 17
def section(routes)
  @buffer << routes.map do |r|
    "#{r[:name]},#{r[:verb]},#{r[:path]},#{r[:reqs]}"
  end
end
section_title(title) click to toggle source
# File lib/better_routes/formatter/csv_formatter.rb, line 13
def section_title(title)
  @current_section = title
end