Class: MiniRacer::Isolate

Inherits:
Object
  • Object
show all
Defined in:
lib/mini_racer/shared.rb,
lib/mini_racer/truffleruby.rb

Instance Method Summary collapse

Constructor Details

#initialize(snapshot = nil) ⇒ Isolate

Returns a new instance of Isolate.



26
27
28
29
30
31
32
33
# File 'lib/mini_racer/shared.rb', line 26

def initialize(snapshot = nil)
  unless snapshot.nil? || snapshot.is_a?(Snapshot)
    raise ArgumentError, "snapshot must be a Snapshot object, passed a #{snapshot.inspect}"
  end

  # defined in the C class
  init_with_snapshot(snapshot)
end

Instance Method Details

#init_with_snapshot(snapshot) ⇒ Object



345
346
347
348
349
# File 'lib/mini_racer/truffleruby.rb', line 345

def init_with_snapshot(snapshot)
  # TruffleRuby does not have a 1-1 concept with isolate.
  # However, isolate can hold a snapshot, and code and ASTs are shared between contexts.
  @snapshot = snapshot
end