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
require 'rack' | |
class Object | |
def webapp | |
tap { | |
def self.call(env) | |
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?) | |
[200, {}, send(func, *attrs)] | |
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
# We want a uniform way of reducing a code tree | |
# so the easiest way to do that is to extend | |
# Object with a call method and whenever any | |
# object does not define it's own call method we | |
# assume the object is implicitly claiming it wants | |
# to return itself. Since Object is almost at the top | |
# of the hierarchy almost anything we are interested | |
# in will work as expected. | |
class Object | |
def call |