123456789_123456789_123456789_123456789_123456789_

Class: Gem::StringSource

Relationships & Source Files
Inherits: Object
Defined in: lib/rubygems/util/stringio.rb

Class Method Summary

Instance Method Summary

Constructor Details

.new(str) ⇒ StringSource

[ GitHub ]

  
# File 'lib/rubygems/util/stringio.rb', line 19

def initialize(str)
  @string = str.dup
end

Instance Method Details

#read(count = nil) Also known as: #readpartial

[ GitHub ]

  
# File 'lib/rubygems/util/stringio.rb', line 23

def read(count=nil)
  if count
    @string.slice!(0,count)
  else
    s = @string
    @string = ""
    s
  end
end

#readpartial(count = nil)

Alias for #read.

[ GitHub ]

  
# File 'lib/rubygems/util/stringio.rb', line 33

alias_method :readpartial, :read