class Rapel::Runtime

Attributes

port[R]
session_id[R]
socket[RW]

Public Class Methods

new(callback_port, session_id) click to toggle source
# File lib/rapel/runtime.rb, line 8
def initialize(callback_port, session_id)
  runtime_port = 9220
  @port = runtime_port
  @session_id = session_id
  system(ruby_runtime_string(callback_port))
end

Public Instance Methods

inspect() click to toggle source
# File lib/rapel/runtime.rb, line 37
def inspect
  "\#<Runtime @session=\"#@session_id\" @ready=#@ready>"
end
ruby_runtime_string(callback_port) click to toggle source
# File lib/rapel/runtime.rb, line 15
def ruby_runtime_string(callback_port)
  ["ruby #{File.dirname(__FILE__)}/../../bin/runtime.rb",
  "--port=#{port}", 
  "--callback-port=#{callback_port}", 
  "--uuid=#{session_id}",
  "&"].join(" ")
end
shutdown() click to toggle source
# File lib/rapel/runtime.rb, line 23
def shutdown
  puts "killing at port #{port}"
  socket.puts("shutdown"+port.to_s)
rescue
  puts "killing pid #{@pid}"
  `kill -9 #{@pid}`
end
start(pid) click to toggle source
# File lib/rapel/runtime.rb, line 31
def start(pid)
  @pid = pid
  @ready = true
  @socket = TCPSocket.new('localhost', port)
end