Last active
October 14, 2015 20:54
-
-
Save ksol/7d49878c09ec01662983 to your computer and use it in GitHub Desktop.
method_added example 1
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 Descriptor | |
| def self.desc(input) | |
| @desc = input | |
| end | |
| def self.method_added(method_name) | |
| puts "Adding #{method_name.inspect}: description is #{@desc}" | |
| @desc = nil | |
| end | |
| desc "My description" | |
| def run | |
| end | |
| end | |
| ### When defining the class, this is the output: | |
| # | |
| # Adding :run: description is My description | |
| # => :run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment