1. Create rb file 1: test1.rb
class Test1
def get_s(str)
puts str
end
end
test1=Test1.new
test1.get_s("test1 rb")
2. Create rb file 2: test2.rb
require 'watir'
class Test2
def test2(str)
puts str
end
end
test2=Test2.new
test2.test2("In test2")
3. Create rb file 3: test3.rb
require 'watir'
path1= File.dirname(__FILE__)+'/test1.rb'
path2= File.dirname(__FILE__)+'/test2.rb'
system("ruby #{path1}")
system("ruby #{path2}")
Attention: test1.rb, test2.rb and test3.rb should be in the same directory.
In test3.rb, you just need to assign the right file directory, you can use system("ruby #{path}") to run the script you want.
Expect it could help.
Wesley
Man should be hard to himself, but tolerant to others.