X.G.2.1 Ruby programming
In this case, most of the VBA programming of post-processing operations has been replaced by
corresponding code in “TESTSAT/VBARUBYEX/RUBY” directory. This code is loaded through the
“main.rb” main file. This file looks as follows:
$: << Dir.getwd+"/RUBY"
$: << "D:/SHARED/FERESPOST/SRC/OUTPUTS/RUBY"
$: << "D:/FERESPOST/BINARIES/FeResPost_4.0.10/RUBY"
$stdout.reopen("main.log","w")
$stdout.sync=true
$stderr=$stdout
require "dl"
require "UTIL/util"
require "UTIL/xls"
require "POSTPROJECT/postProject"
One makes the following comments:
- The first lines update the list of directories from which ruby files and extensions
shall be loaded. You must change these lines according to the local configuration of
your computer. Note that the first directory added to the list is defined relative to
the current working directory. The rest of the programming assumes that the working
directory is the one in which “PostProject.xlsm” is located. A special VBA command in
“PostProject.xlsm” has been added to ensure it is the case.
- The following lines redirect standard outputs to “main.log” file. This can be handy when
you have a bug and you want to retrieve ruby error messages.
- Finally, the lines that follow perform “require” statements that load the programmed
modules. The “postProject” require corresponds to most of the post-processing
programming.
Note that the example we provide here depends on the availability of “FeResPost” and “sqlite3” ruby
extensions. The example will not work on your computer if these two modules are not properly
installed.