Created
December 7, 2017 22:45
-
-
Save luislavena/ac5255db75c0dd9343ecfc34b611f194 to your computer and use it in GitHub Desktop.
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
abstract class Foo | |
VERBS = %w(GET POST PUT) | |
{% for method in ::Foo::VERBS %} | |
macro {{ method.downcase.id }}(*args, **params) | |
\{% params[:via] = {{ method.downcase }} %} | |
match(\{{*args}}, \{{**params}}) | |
end | |
{% end %} | |
def self.match(*args, **params) | |
puts args, params | |
end | |
end | |
class Bar < Foo | |
get "/path", to: "X" | |
end |
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
{"/path"} | |
{to: "X", via: "get"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment