Created
January 14, 2012 00:14
-
-
Save shime/1609496 to your computer and use it in GitHub Desktop.
instance_eval explanation
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
val = "pizdarija" | |
val.randomize | |
val.instance_eval do | |
def randomize | |
split(//).to_a.shuffle.join | |
end | |
end | |
val.randomize | |
val2 = "faraon" | |
val2.randomize | |
String.class_eval do | |
def randomize | |
puts "defined with class eval" | |
split(//).to_a.shuffle.join | |
end | |
end | |
"drek".randomize | |
val.randomize |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bacat će ti errore na linijama 3 i 17, zbriši ih. To je čisto tek toliko da vidiš.