Class: ExecJS::PCRuntime::ContextProcessRuntime
- Inherits:
-
Runtime
- Object
- Runtime
- ExecJS::PCRuntime::ContextProcessRuntime
- Defined in:
- lib/execjs/pcruntime/context_process_runtime.rb
Overview
implementation of ExecJS::Runtime
Defined Under Namespace
Classes: Context, JSRuntimeHandle
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
rubocop:enable Metrics/ClassLength.
Instance Method Summary collapse
-
#available? ⇒ Boolean
implementation of ExecJS::Runtime#available?.
-
#create_runtime_handle(compile_source) ⇒ JSRuntimeHandle
Launch JavaScript Runtime and return its handle.
-
#deprecated? ⇒ Boolean
override ExecJS::Runtime#deprecated?.
-
#initialize(name, command, runner_path = File.expand_path('runner.js', __dir__), deprecated: false) ⇒ ContextProcessRuntime
constructor
A new instance of ContextProcessRuntime.
Constructor Details
#initialize(name, command, runner_path = File.expand_path('runner.js', __dir__), deprecated: false) ⇒ ContextProcessRuntime
Returns a new instance of ContextProcessRuntime.
247 248 249 250 251 252 253 254 255 256 |
# File 'lib/execjs/pcruntime/context_process_runtime.rb', line 247 def initialize(name, command, runner_path = File.('runner.js', __dir__), deprecated: false) super() @name = name @command = command @runner_path = runner_path @binary = nil @deprecated = deprecated # limit number of threads 128 to avoid Errno::ECONNREFUSED @semaphore = Semaphore.new 128 end |
Instance Attribute Details
#name ⇒ Object (readonly)
rubocop:enable Metrics/ClassLength
242 243 244 |
# File 'lib/execjs/pcruntime/context_process_runtime.rb', line 242 def name @name end |
Instance Method Details
#available? ⇒ Boolean
implementation of ExecJS::Runtime#available?
259 260 261 |
# File 'lib/execjs/pcruntime/context_process_runtime.rb', line 259 def available? binary ? true : false end |
#create_runtime_handle(compile_source) ⇒ JSRuntimeHandle
Launch JavaScript Runtime and return its handle.
270 271 272 |
# File 'lib/execjs/pcruntime/context_process_runtime.rb', line 270 def create_runtime_handle(compile_source) JSRuntimeHandle.new(binary, @runner_path, compile_source, @semaphore) end |
#deprecated? ⇒ Boolean
override ExecJS::Runtime#deprecated?
264 265 266 |
# File 'lib/execjs/pcruntime/context_process_runtime.rb', line 264 def deprecated? @deprecated end |