Created
June 5, 2016 12:24
-
-
Save codesword/b31cc743f7054d02770622e8044540e8 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
| class Router | |
| [:get, :post, :put, :patch, :delete].each do |method_name| | |
| define_method(method_name) do | |
| "This is a #{method_name} method" | |
| end | |
| end | |
| end | |
| router = Router.new | |
| router.get #=> "This is a get method" | |
| router.post #=> "This is a post method" | |
| router.delete #=> "This is a delete method" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment