June 24th, 2012, 08:27 PM
Join Date: Jun 2012
Time spent in forums: 14 m 48 sec
Reputation Power: 0
Calling an RB File from another one
I have a main RB file (gem) that runs, it's a siriproxy server. Basically, it runs and listens to commands and executes script when it catches matching text.
So I am now using an rb file seperately, which returns my paypal balance. So basically, paypal.rb when execute simply returns a number, a paypal balance.
I need to get the number that paypal.rb returns into the initial script.
Is it possible to do this and how would I go about that? I was thinking in my main program I can do "require paypal.rb"
and then I could call the command but I am not sure how?
Any help would be great.
The paypal.rb file contains this code,
username = 'xx'
password = 'xx'
signature = 'xx'
paypal = Paypal.new username, password, signature, :production
# silence annoying output
class CaptureOutput < IO
# send text to logfile
raise unless block_given?
dout, serr, sout = $defout, $stderr, $stdout
buf = CaptureOutput.new
$defout = buf
$stderr = buf
$stdout = buf
$defout, $stderr, $stdout = dout, serr, sout
paypal = paypal.make_nvp_call 'METHOD' => 'GetBalance'
if paypal.ack == 'Success'