Created
August 7, 2012 23:31
-
-
Save bricker/3290538 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 Something | |
private | |
def words | |
"Hello" | |
end | |
end | |
class Else < Something | |
end | |
begin | |
puts "running `Else.new.words`" | |
words = Else.new.words | |
puts words | |
rescue Exception => e | |
puts e | |
end | |
begin | |
puts "running `Else.new.send(:words)`" | |
words = Else.new.send(:words) | |
puts words | |
rescue Exception => e | |
puts e | |
end | |
########################## | |
#=> running `Else.new.words` | |
#=> private method `words' called for #<Else:0x007f7fc984dff0> | |
#=> running `Else.new.send(:words)` | |
#=> Hello |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment