Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
instance_eval explanation
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
@shime

This comment has been minimized.

Copy link
Owner Author

commented Jan 14, 2012

Bacat će ti errore na linijama 3 i 17, zbriši ih. To je čisto tek toliko da vidiš.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.