Module: RxIO::HandlerBase

Defined in:
lib/rxio/handler_base.rb

Overview

Handler Base Module: Provides common abstractions to Service Handler implementations.

Instance Method Summary collapse

Instance Method Details

#buffer_input(endpoint, chunk) ⇒ Object

Buffer Input Chunk: Writes a chunk of data to the endpoint’s input buffer (:ibuf).

Parameters:

  • endpoint (Hash)
  • chunk (String)


25
26
27
28
29
# File 'lib/rxio/handler_base.rb', line 25

def buffer_input endpoint, chunk

	# Buffer Chunk
	endpoint[:ibuf] << chunk
end

#write(endpoint, *data) ⇒ Object

Write: Writes one or more chunks of data to the endpoint’s output buffer (:obuf).

Parameters:

  • endpoint (Hash)
  • data (String)

    One or more chunks of data to be written to the ouput buffer



15
16
17
18
19
# File 'lib/rxio/handler_base.rb', line 15

def write endpoint, *data

	# Add Data Chunks to Buffer
	data.each { |c| endpoint[:lock].synchronize { endpoint[:obuf] << c.to_s } }
end