1 [:get, :post, :patch, :put, :delete, :head, :before, :after].each do |verb| 2 real_method = :"real_#{verb}" 3 alias_method real_method, verb 4 define_method(verb) do |path = nil, opts = {}, &block| 5 create_route(verb, real_method, path, opts, 1, &block) 6 end 7 end 8 9 def create_route(...) 10 # method call that calls caller 11 end 12 13 # this is actually a different file that loads the above (caller_file) 14 15 get '/foo' do 16 ... 17 end 18 19 patch '/bar' do 20 ... 21 end ``` when patch is called, stack trace looks like ``` file.rb:10:in `create_route' file.rb:9:in `create_route' file.rb:5:in `block in patch' caller_file.rb:38:in `' ``` when get it called stack trace looks like: ``` file.rb:10:in `create_route' file.rb:5:in `block in get' caller_file.rb:15:in `'