Class: Isomorfeus::Speednode::Runtime

Inherits:
ExecJS::Runtime
  • Object
show all
Defined in:
lib/isomorfeus/speednode/runtime.rb

Defined Under Namespace

Classes: Context, VM, VMCommand

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Runtime

Returns a new instance of Runtime.



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/isomorfeus/speednode/runtime.rb', line 148

def initialize(options)
  @name        = options[:name]
  @binary      = Isomorfeus::Speednode::NodeCommand.cached(options[:command])
  @runner_path = options[:runner_path]
  @encoding    = options[:encoding]
  @deprecated  = !!options[:deprecated]

  @vm = VM.new(
    binary: @binary,
    runner_path: @runner_path
  )

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



146
147
148
# File 'lib/isomorfeus/speednode/runtime.rb', line 146

def name
  @name
end

#vmObject (readonly)

Returns the value of attribute vm.



146
147
148
# File 'lib/isomorfeus/speednode/runtime.rb', line 146

def vm
  @vm
end

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


165
166
167
# File 'lib/isomorfeus/speednode/runtime.rb', line 165

def available?
  @binary ? true : false
end

#deprecated?Boolean

Returns:

  • (Boolean)


169
170
171
# File 'lib/isomorfeus/speednode/runtime.rb', line 169

def deprecated?
  @deprecated
end