I have a chunk of code that has commands. I want to keep more commands in a separate file and pull them into the main. Thus my main file can be updated without losing any custom commands. How would I go about that?
{
class myClass()
#commands
listen_for /what is your name/i do
say "my name is mud"
end
## Insert Custom.rb here ##
# Everything in the custom rb file is just ike the "listen_for" command above
end
}
The answe above will not work in this case because there is no listen_for methods defined in the custom.rb file
wrap whatever you have in
custom.rb
in a module, likerequire your file
custom.rb
on the top of your script and include it in your class:This is the new try
Remove the
module
wrapper in the listen_for commands, and instead simply list them in thecustom.rb
as you would do inside your main class definition. And in your main class, Read and eval it, like this: