Class: OpenURI::Buffer

Inherits:
Object show all
Defined in:
opal/stdlib/open-uri.rb

Overview

:nodoc: all

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBuffer

Returns a new instance of Buffer



180
181
182
183
# File 'opal/stdlib/open-uri.rb', line 180

def initialize
  @io = StringIO.new
  @size = 0
end

Instance Attribute Details

#sizeObject (readonly)

Returns the value of attribute size



184
185
186
# File 'opal/stdlib/open-uri.rb', line 184

def size
  @size
end

Instance Method Details

#<<(str) ⇒ Object



186
187
188
189
# File 'opal/stdlib/open-uri.rb', line 186

def <<(str)
  @io << str
  @size += str.length
end

#ioObject



191
192
193
194
# File 'opal/stdlib/open-uri.rb', line 191

def io
  Meta.init @io unless Meta === @io
  @io
end