Hi
I’m currently writing a tool where the data-structure is coded in C++,
but manipulated in wonderful Ruby. I had also added some ‘ruby
goodness’ to the C++ classes, such as providing “.each_X” iteration
methods for use within the ruby part of the system.
assume that the class Architecture is defined in a module Nest, all
implemented in C++ but with ruby hooks generated by SWIG.
with ruby 1.6.8, i could do the following:
require ‘Nest’ # load the C++ extension
=> true
include Nest
=> Object
class Architecture
def newMethod
puts "hi from ruby"
end
end
=> nil
… and now i could call ‘newMethod’ along with all the other instance
methods for Architecture defined in the C++ source.
however, with Ruby 1.8.0 this stopped working, giving the error:
NameError: undefined constant Architecture
…and the only way I can get it running is if i do the following:
require 'Nest’
include Nest
class Nest::Architecture
define the new methods
end
is this expected?
- James Adam