This file contains 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
# | |
# Run this with `rails runner route_ast.rb` | |
# | |
Rails.application.routes.routes.each do |route| | |
ast = route.ast | |
# do stuff with AST... | |
end |
This file contains 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
module OneLinerExamples | |
# https://github.com/rack/rack/blob/f9ad97fd/lib/rack/request.rb#L150-L155 | |
def body := get_header(RACK_INPUT) | |
def script_name := get_header(SCRIPT_NAME).to_s | |
def script_name=(s) := set_header(SCRIPT_NAME, s.to_s) | |
def path_info := get_header(PATH_INFO).to_s | |
def path_info=(s) := set_header(PATH_INFO, s.to_s) | |
# https://github.com/rack/rack/blob/f9ad97fd/lib/rack/response.rb#L126-L129 |
OlderNewer