Eval
From RubySpec
Contents |
[edit]
Eval
The eval function lets one evaluate the expression inside a string. Here are some examples:
eval("7+12") #evaluates to 19
eval("Math.sin(30*Math::PI/180)") #gives 0.5
Be careful with eval in web applications(refer to Programming Ruby 2nd edition)
[edit]
class_eval
[edit]
instance_eval
[edit]

