Last active
June 20, 2018 19:29
-
-
Save tushartuteja/b8559e271d89f2de6fb1efa835088f0e 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 | |
puts "at the starting of person class" | |
###### Look Here ######## | |
def self.my_attr_reader variable_name | |
evaluate_string = "def #{variable_name} \n" + | |
"return @#{variable_name} \n" + | |
"end \n" | |
eval(evaluate_string) | |
end | |
my_attr_reader "name" | |
###### Code in discussion Ends ########## | |
def initialize name, age | |
@name = name | |
@age = age | |
end | |
puts "at the end of person class" | |
end | |
person = Person.new("Tushar", 27) | |
puts(person.name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment