Skip to content

Instantly share code, notes, and snippets.

@ksol
Last active October 14, 2015 20:54
Show Gist options
  • Select an option

  • Save ksol/7d49878c09ec01662983 to your computer and use it in GitHub Desktop.

Select an option

Save ksol/7d49878c09ec01662983 to your computer and use it in GitHub Desktop.
method_added example 1
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