I ask the user to enter a name for a new class that I want to create. My code is:
puts "enter the name for a new class that you want to create"
nameofclass = gets.chomp
nameofclass = Class.new
Why does this not work?
Also, I want to ask the user to enter the name of a method that I want to add to that class. My code is:
puts "enter the name for a new method that you want to add to that class"
nameofmethod = gets.chomp
nameofclass.class_eval do
def nameofmethod
p "whatever"
end
end
This does not work either.