Method: NodeRunner::Executor#initialize

Defined in:
lib/node-runner.rb

#initialize(options = {}) ⇒ Executor

Returns a new instance of Executor.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/node-runner.rb', line 86

def initialize(options = {})
  @command     = options[:command] || ['node']
  @runner_path = options[:runner_path] || File.join(File.expand_path(__dir__), '/node_runner.js')
  @encoding    = options[:encoding] || "UTF-8"
  @binary      = nil

  @popen_options = {}
  @popen_options[:external_encoding] = @encoding if @encoding
  @popen_options[:internal_encoding] = ::Encoding.default_internal || 'UTF-8'

  if @runner_path
    instance_eval generate_compile_method(@runner_path)
  end
end