Module: Less::CallJS
Overview
Utility for calling into the JavaScript runtime.
Instance Method Summary collapse
-
#calljs { ... } ⇒ Object
Wrap JavaScript invocations with uniform error handling.
-
#lock { ... } ⇒ Object
Ensure proper locking before entering the V8 API.
Instance Method Details
#calljs { ... } ⇒ Object
Wrap JavaScript invocations with uniform error handling
11 12 13 14 15 16 17 |
# File 'lib/less/parser.rb', line 11 def calljs lock do yield end rescue V8::JSError => e raise ParseError.new(e) end |
#lock { ... } ⇒ Object
Ensure proper locking before entering the V8 API
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/less/parser.rb', line 23 def lock result, exception = nil, nil V8::C::Locker() do begin result = yield rescue Exception => e exception = e end end if exception raise exception else result end end |