Class: Palta::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/palta/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host = "localhost", port = 8888) ⇒ Client

Returns a new instance of Client.



11
12
13
14
# File 'lib/palta/client.rb', line 11

def initialize host="localhost", port=8888
  @host = host
  @port = port
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



9
10
11
# File 'lib/palta/client.rb', line 9

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



9
10
11
# File 'lib/palta/client.rb', line 9

def port
  @port
end

Instance Method Details

#send(data) ⇒ Object



16
17
18
19
20
# File 'lib/palta/client.rb', line 16

def send data
  TCPSocket.open @host, @port do |s|
    s.send data.to_json, 0
  end
end