class JsonRoutesFormatter

Public Class Methods

new() click to toggle source
# File lib/lazy_api_doc/route_parser.rb, line 27
def initialize
  @buffer = []
end

Public Instance Methods

header(_routes) click to toggle source
# File lib/lazy_api_doc/route_parser.rb, line 47
def header(_routes); end
result() click to toggle source
# File lib/lazy_api_doc/route_parser.rb, line 31
def result
  @buffer
end
section(routes) click to toggle source
# File lib/lazy_api_doc/route_parser.rb, line 37
def section(routes)
  @buffer = routes.map do |r|
    r[:doc_path] = r[:path].gsub("(.:format)", "").gsub(/(:\w+)/, '{\1}').delete(":")
    r[:path_params] = r[:path].gsub("(.:format)", "").scan(/:\w+/).map { |p| p.delete(":").to_sym }
    r[:controller] = r[:reqs].split("#").first
    r[:action] = r[:reqs].split("#").last.split(" ").first
    r
  end
end
section_title(_title) click to toggle source
# File lib/lazy_api_doc/route_parser.rb, line 35
def section_title(_title); end