Class: Rum::Remote

Inherits:
Object
  • Object
show all
Defined in:
lib/rum/remote.rb

Defined Under Namespace

Modules: Connection

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(port = Remote.default_port) ⇒ Remote

Returns a new instance of Remote.



5
6
7
# File 'lib/rum/remote.rb', line 5

def initialize(port=Remote.default_port)
  @connection = Connection.new(TCPSocket.open('127.0.0.1', port))
end

Class Method Details

.default_portObject



18
19
20
21
22
23
24
# File 'lib/rum/remote.rb', line 18

def self.default_port
  if (port = ENV['RUM_PORT'].to_i) and port.nonzero?
    port
  else
    1994
  end
end

Instance Method Details

#disconnectObject



14
15
16
# File 'lib/rum/remote.rb', line 14

def disconnect
  @connection.close
end

#eval(code) ⇒ Object



9
10
11
12
# File 'lib/rum/remote.rb', line 9

def eval code
  @connection.dispatch code
  @connection.receive
end