Created
October 5, 2011 16:29
-
-
Save terrbear/1264928 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
class JiraTicket | |
def hello_there | |
"hello there" | |
end | |
end | |
jt = JiraTicket.new | |
puts "hello there: #{jt.hello_there}" | |
JiraTicket.class_eval do | |
def bye_bye | |
"bye bye!" | |
end | |
end | |
puts "jt has it? #{jt.respond_to?(:bye_bye)}" | |
puts "what about jt2? #{JiraTicket.new.respond_to?(:bye_bye)}" | |
#output: | |
#hello there: hello there | |
#jt has it? true | |
#what about jt2? true | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment