Class: WebSocketClient::ArrayByteSource

Inherits:
ByteSource
  • Object
show all
Defined in:
lib/websocket_client/byte_source.rb

Instance Method Summary collapse

Methods inherited from ByteSource

#getbytes

Constructor Details

#initialize(array) ⇒ ArrayByteSource



86
87
88
89
# File 'lib/websocket_client/byte_source.rb', line 86

def initialize(array)
  @array = array
  @cur = 0
end

Instance Method Details

#eof?Boolean



97
98
99
# File 'lib/websocket_client/byte_source.rb', line 97

def eof?
  ( @cur >= @array.size )
end

#getbyteObject



91
92
93
94
95
# File 'lib/websocket_client/byte_source.rb', line 91

def getbyte
  b = @array[@cur]
  @cur += 1
  b
end