diff --git a/doc/stringio/each_byte.rdoc b/doc/stringio/each_byte.rdoc index a635ce3..5201afb 100644 --- a/doc/stringio/each_byte.rdoc +++ b/doc/stringio/each_byte.rdoc @@ -7,10 +7,7 @@ returns +self+: strio.each_byte {|byte| bytes.push(byte) } strio.eof? # => true bytes # => [104, 101, 108, 108, 111] - bytes = [] - strio = StringIO.new('тест') # Four 2-byte characters. - strio.each_byte {|byte| bytes.push(byte) } - bytes # => [209, 130, 208, 181, 209, 129, 209, 130] + bytes = [] strio = StringIO.new('こんにちは') # Five 3-byte characters. strio.each_byte {|byte| bytes.push(byte) } diff --git a/doc/stringio/each_char.rdoc b/doc/stringio/each_char.rdoc index d0ab189..bde0e3a 100644 --- a/doc/stringio/each_char.rdoc +++ b/doc/stringio/each_char.rdoc @@ -7,10 +7,7 @@ returns +self+: strio.each_char {|char| chars.push(char) } strio.eof? # => true chars # => ["h", "e", "l", "l", "o"] - chars = [] - strio = StringIO.new('тест') - strio.each_char {|char| chars.push(char) } - chars # => ["т", "е", "с", "т"] + chars = [] strio = StringIO.new('こんにちは') strio.each_char {|char| chars.push(char) } diff --git a/doc/stringio/each_codepoint.rdoc b/doc/stringio/each_codepoint.rdoc index 2fc33f4..af70b4c 100644 --- a/doc/stringio/each_codepoint.rdoc +++ b/doc/stringio/each_codepoint.rdoc @@ -9,10 +9,7 @@ Each codepoint is the integer value for a character; returns self: strio.each_codepoint {|codepoint| codepoints.push(codepoint) } strio.eof? # => true codepoints # => [104, 101, 108, 108, 111] - codepoints = [] - strio = StringIO.new('тест') - strio.each_codepoint {|codepoint| codepoints.push(codepoint) } - codepoints # => [1090, 1077, 1089, 1090] + codepoints = [] strio = StringIO.new('こんにちは') strio.each_codepoint {|codepoint| codepoints.push(codepoint) } diff --git a/doc/stringio/getbyte.rdoc b/doc/stringio/getbyte.rdoc index 5e52494..148455a 100644 --- a/doc/stringio/getbyte.rdoc +++ b/doc/stringio/getbyte.rdoc @@ -14,13 +14,6 @@ Returns +nil+ if at end-of-stream: Returns a byte, not a character: - s = 'Привет' - s.bytes - # => [208, 159, 209, 128, 208, 184, 208, 178, 208, 181, 209, 130] - strio = StringIO.new(s) - strio.getbyte # => 208 - strio.getbyte # => 159 - s = 'こんにちは' s.bytes # => [227, 129, 147, 227, 130, 147, 227, 129, 171, 227, 129, 161, 227, 129, 175] diff --git a/doc/stringio/getc.rdoc b/doc/stringio/getc.rdoc index b2ab468..58ce47c 100644 --- a/doc/stringio/getc.rdoc +++ b/doc/stringio/getc.rdoc @@ -12,10 +12,6 @@ Returns +nil+ if at end-of-stream: Returns characters, not bytes: - strio = StringIO.new('Привет') - strio.getc # => "П" - strio.getc # => "р" - strio = StringIO.new('こんにちは') strio.getc # => "こ" strio.getc # => "ん" diff --git a/doc/stringio/gets.rdoc b/doc/stringio/gets.rdoc index bf72d50..a8706b0 100644 --- a/doc/stringio/gets.rdoc +++ b/doc/stringio/gets.rdoc @@ -19,10 +19,10 @@ With no arguments given, reads a line using the default record separator strio.eof? # => true strio.gets # => nil - strio = StringIO.new('Привет') # Six 2-byte characters + strio = StringIO.new('こんにちは') # Five 3-byte characters. strio.pos # => 0 - strio.gets # => "Привет" - strio.pos # => 12 + strio.gets # => "こんにちは" + strio.pos # => 15 Argument +sep+ @@ -67,11 +67,11 @@ but in other cases the position may be anywhere: The position need not be at a character boundary: - strio = StringIO.new('Привет') # Six 2-byte characters. - strio.pos = 2 # At beginning of second character. - strio.gets # => "ривет" - strio.pos = 3 # In middle of second character. - strio.gets # => "\x80ивет" + strio = StringIO.new('こんにちは') # Five 3-byte characters. + strio.pos = 3 # At beginning of second character. + strio.gets # => "んにちは" + strio.pos = 4 # Within second character. + strio.gets # => "\x82\x93にちは" Special Record Separators diff --git a/doc/stringio/size.rdoc b/doc/stringio/size.rdoc index 9323adf..253c612 100644 --- a/doc/stringio/size.rdoc +++ b/doc/stringio/size.rdoc @@ -1,5 +1,4 @@ Returns the number of bytes in the string in +self+: StringIO.new('hello').size # => 5 # Five 1-byte characters. - StringIO.new('тест').size # => 8 # Four 2-byte characters. StringIO.new('こんにちは').size # => 15 # Five 3-byte characters. diff --git a/doc/stringio/stringio.md b/doc/stringio/stringio.md index 8931d1c..07071ee 100644 --- a/doc/stringio/stringio.md +++ b/doc/stringio/stringio.md @@ -409,13 +409,15 @@ strio.pos = 24 strio.gets # => "Fourth line\n" strio.pos # => 36 -strio = StringIO.new('тест') # Four 2-byte characters. -strio.pos = 0 # At first byte of first character. -strio.read # => "тест" -strio.pos = 1 # At second byte of first character. -strio.read # => "\x82ест" -strio.pos = 2 # At first of second character. -strio.read # => "ест" +strio = StringIO.new('こんにちは') # Five 3-byte characters. +strio.pos = 0 # At first byte of first character. +strio.read # => "こんにちは" +strio.pos = 1 # At second byte of first character. +strio.read # => "\x81\x93んにちは" +strio.pos = 2 # At third byte of first character. +strio.read # => "\x93んにちは" +strio.pos = 3 # At first byte of second character. +strio.read # => "んにちは" strio = StringIO.new(TEXT) strio.pos = 15