Created
August 11, 2011 07:34
-
-
Save allomov/1139094 to your computer and use it in GitHub Desktop.
fast way to blow your mind
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 A | |
def hello | |
self.world | |
end | |
private | |
def world | |
puts "world" | |
end | |
end | |
# it will raise exeption, 'cause private methods can't be evoked with reciever | |
A.new.hello rescue Exception | |
class B | |
def hello | |
self.world = "mind is blown" | |
end | |
private | |
def world=(args) | |
puts "and what did you expected ? it's Ruby )" | |
end | |
end | |
# IT WORKS !!! | |
B.new.hello |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment