Class: Gem::StringSource
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/rubygems/util/stringio.rb |
Class Method Summary
- .new(str) ⇒ StringSource constructor
Instance Method Summary
- #read(count = nil) (also: #readpartial)
-
#readpartial(count = nil)
Alias for #read.
Constructor Details
.new(str) ⇒ StringSource
# 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.
# File 'lib/rubygems/util/stringio.rb', line 33
alias_method :readpartial, :read