Class: MiniRacer::Isolate
- Inherits:
-
Object
- Object
- MiniRacer::Isolate
- Defined in:
- lib/mini_racer.rb
Instance Method Summary collapse
-
#initialize(snapshot = nil) ⇒ Isolate
constructor
A new instance of Isolate.
- #with_lock ⇒ Object
Constructor Details
#initialize(snapshot = nil) ⇒ Isolate
Returns a new instance of Isolate.
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/mini_racer.rb', line 52 def initialize(snapshot = nil) unless snapshot.nil? || snapshot.is_a?(Snapshot) raise ArgumentError, "snapshot must be a Snapshot object, passed a #{snapshot.inspect}" end @lock = Mutex.new # defined in the C class init_with_snapshot(snapshot) end |
Instance Method Details
#with_lock ⇒ Object
63 64 65 |
# File 'lib/mini_racer.rb', line 63 def with_lock @lock.synchronize { yield } end |