Evaluating a String

suggest change

A string of Ruby source can be evaluated at runtime. eval runs it as code in the current scope.

class Example
  def self.foo
    :foo
  end
end

eval "Example.foo" #=> :foo

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents