Created
March 21, 2015 15:10
-
-
Save davidpatters0n/b7d3090763f183637659 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def eval_string(klass, attrib) | |
s = <<EOS | |
class #{klass} | |
def #{attrib} | |
@#{attrib} | |
end | |
def #{attrib}=(value) | |
@#{attrib} = value | |
end | |
end | |
EOS | |
return s | |
end | |
eval(eval_string(String, "ahmet")) | |
x = String.new | |
x.ahmet = "abdi" | |
puts x.ahmet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment