Class: Riser::Stream

Inherits:
Object
  • Object
show all
Defined in:
lib/riser/stream.rb

Direct Known Subclasses

LoggingStream, WriteBufferStream

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ Stream

Returns a new instance of Stream.



5
6
7
# File 'lib/riser/stream.rb', line 5

def initialize(io)
  @io = io
end

Instance Method Details

#<<(message) ⇒ Object



29
30
31
32
# File 'lib/riser/stream.rb', line 29

def <<(message)
  write(message)
  self
end

#closeObject



39
40
41
42
43
# File 'lib/riser/stream.rb', line 39

def close
  flush
  @io.close
  nil
end

#flushObject



34
35
36
37
# File 'lib/riser/stream.rb', line 34

def flush
  @io.flush
  self
end

#getsObject



13
14
15
# File 'lib/riser/stream.rb', line 13

def gets
  @io.gets
end

#read(size) ⇒ Object



17
18
19
# File 'lib/riser/stream.rb', line 17

def read(size)
  @io.read(size)
end

#readpartial(maxlen, outbuf = nil) ⇒ Object



21
22
23
# File 'lib/riser/stream.rb', line 21

def readpartial(maxlen, outbuf=nil)
  @io.readpartial(maxlen, outbuf)
end

#to_ioObject



9
10
11
# File 'lib/riser/stream.rb', line 9

def to_io
  @io.to_io
end

#write(message) ⇒ Object



25
26
27
# File 'lib/riser/stream.rb', line 25

def write(message)
  @io.write(message)
end