Class: Palta::Client
- Inherits:
-
Object
- Object
- Palta::Client
- Defined in:
- lib/palta/client.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
-
#initialize(host = "localhost", port = 8888) ⇒ Client
constructor
A new instance of Client.
- #send(data) ⇒ Object
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
#host ⇒ Object (readonly)
Returns the value of attribute host.
9 10 11 |
# File 'lib/palta/client.rb', line 9 def host @host end |
#port ⇒ Object (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 |