Method: Rri::Engine#initialize

Defined in:
lib/rri/engine.rb

#initialize(options = {}) ⇒ Engine

Create a new instance of Engine

Parameters:

  • options (Hash) (defaults to: {})

    A Hash of options to override the defaults, or not given in which case the defaults will be used.



119
120
121
122
123
124
125
126
127
128
129
# File 'lib/rri/engine.rb', line 119

def initialize(options = {})
  combined_options = DEFAULT_ENGINE_OPTIONS.merge(options)
  
  @engine = Jri::JRIEngine.new(combined_options[:r_arguments].to_java(:string),
                               combined_options[:callback_object],
                               combined_options[:run_repl])
                              
  # the R thread wont die unless we call #close on @engine, so make sure this
  # happens when this object is finalized.
  ObjectSpace.define_finalizer(self, self.class.finalize(@engine))
end