Class: Toycol::Client
- Inherits:
-
Object
- Object
- Toycol::Client
- Extended by:
- Helper
- Defined in:
- lib/toycol/client.rb
Constant Summary collapse
- CHUNK_SIZE =
1024 * 16
Class Attribute Summary collapse
-
.host ⇒ Object
writeonly
Sets the attribute host.
-
.port ⇒ Object
writeonly
Sets the attribute port.
Class Method Summary collapse
Methods included from Helper
Class Attribute Details
.host=(value) ⇒ Object (writeonly)
Sets the attribute host
12 13 14 |
# File 'lib/toycol/client.rb', line 12 def host=(value) @host = value end |
.port=(value) ⇒ Object (writeonly)
Sets the attribute port
12 13 14 |
# File 'lib/toycol/client.rb', line 12 def port=(value) @port = value end |
Class Method Details
.execute!(request_message, &block) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/toycol/client.rb', line 14 def execute!(, &block) socket = TCPSocket.new(@host, @port) socket.write() logger "Sent request message: #{}\n---" = [] << socket.readpartial(CHUNK_SIZE) until socket.eof? = .join block ||= default_proc block.call() ensure socket.close end |