Class: DRb::HTTP0::StrStream

Inherits:
Object
  • Object
show all
Defined in:
lib/drb/http0.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str = '') ⇒ StrStream

Returns a new instance of StrStream.



10
11
12
# File 'lib/drb/http0.rb', line 10

def initialize(str='')
  @buf = str
end

Instance Attribute Details

#bufObject (readonly)

Returns the value of attribute buf.



13
14
15
# File 'lib/drb/http0.rb', line 13

def buf
  @buf
end

Instance Method Details

#read(n) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/drb/http0.rb', line 15

def read(n)
  begin
    return @buf[0,n]
  ensure
    @buf[0,n] = ''
  end
end

#write(s) ⇒ Object



23
24
25
# File 'lib/drb/http0.rb', line 23

def write(s)
  @buf.concat s
end