-
-
Save adam12/67bdefa21f7042a0730c4be9954c0e80 to your computer and use it in GitHub Desktop.
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 WebAction | |
def self.inherited(subclass) | |
super | |
subclass.prepend Callable | |
end | |
module Callable | |
# Set up instance method that accepts env, request, response | |
# and calls method inside Action without any arguments. | |
def call(env, request, response) | |
@env = env | |
@_request = request | |
@_response = response | |
super() | |
end | |
end | |
end | |
class SomeAction | |
include WebAction | |
def call | |
# Look mah, no arguments | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment