Created
December 17, 2013 07:43
-
-
Save holysugar/8001435 to your computer and use it in GitHub Desktop.
define_print_routes(SinatraClass)
元は http://d.hatena.ne.jp/rightgo09_ruby/20130622/p1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def define_print_routes(sinatra_class) | |
def sinatra_class.print_routes(io = $stdout) | |
routes.each do |verb, signatures| | |
next if verb == "HEAD" | |
signatures.each do |signature| | |
path = signature.first.source | |
path.gsub!(/(\A\\A|\\z\z)/, '') | |
puts "%-6s %s" % [verb, path] | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ソート工夫したほうがよりよい気がする