Skip to content

Instantly share code, notes, and snippets.

@allomov
Created August 11, 2011 07:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allomov/1139094 to your computer and use it in GitHub Desktop.
Save allomov/1139094 to your computer and use it in GitHub Desktop.
fast way to blow your mind
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