Method: ScriptCore::Engine#initialize
- Defined in:
- lib/script_core/engine.rb
#initialize(bin_path = ScriptCore::DEFAULT_BIN_PATH, executable_name: "enterprise_script_service", instructions_name: "enterprise_script_service.mrb") ⇒ Engine
Returns a new instance of Engine.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/script_core/engine.rb', line 7 def initialize(bin_path = ScriptCore::DEFAULT_BIN_PATH, executable_name: "enterprise_script_service", instructions_name: "enterprise_script_service.mrb") raise Errno::ENOENT, "No such directory - #{bin_path}" unless File.directory?(bin_path) @bin_path = bin_path @executable = ScriptCore::Executable.new(@bin_path.join(executable_name)) @timeout = 1 @instruction_quota = 100_000 @instruction_quota_start = 0 @memory_quota = 8 << 20 preload_instructions_path = @bin_path.join(instructions_name) @instructions = File.exist?(preload_instructions_path) ? File.binread(preload_instructions_path) : nil end |