Hi, I have a quick question in Ruby
Lets say 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
-Can anyone help me please, Thank you