R
Roeland Moors
I'm creating a program which uses a ruby source file as config
file.
I don't know which methods are defined in this config file.
The problem I have is that I would like to run a method with the same
name as a string.
Example:
This is the config file
class Main
def test1
puts 'test1'
end
def test2
puts 'test2'
end
end
This is the main source:
$method = "test1"
$mode = Main.new
# this ofcours doesn't work:
$mode.$method
How should I do this?
file.
I don't know which methods are defined in this config file.
The problem I have is that I would like to run a method with the same
name as a string.
Example:
This is the config file
class Main
def test1
puts 'test1'
end
def test2
puts 'test2'
end
end
This is the main source:
$method = "test1"
$mode = Main.new
# this ofcours doesn't work:
$mode.$method
How should I do this?