Created
June 5, 2016 11:55
-
-
Save codesword/4f0f2473caf4d9e0a796d9ccc4fb8927 to your computer and use it in GitHub Desktop.
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
class Person | |
c = %q{def company; "Andela"; end} | |
instance_eval(c) | |
def initialize | |
@name = "Ikem Okonkwo" | |
end | |
def make | |
instance_eval("def name; 'Ikem Okonkwo'; end") | |
end | |
end | |
p = Person.new | |
p.name #=> undefined method error | |
p.make | |
p.name #=> "Ikem Okonkwo" | |
p.company #=> undefined method error | |
Person.company #=> "Andela |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment