Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
67f830e
[ruby/stringio] Development of 3.2.1 started.
kou Dec 17, 2025
354dc57
[ruby/stringio] [DOC] Doc for StringIO#pread
BurdetteLamar Dec 23, 2025
9a76ccd
[ruby/stringio] [DOC] Doc for StringIO#putc
BurdetteLamar Dec 23, 2025
ae46f91
[ruby/stringio] [DOC] Doc for StringIO#read
BurdetteLamar Dec 23, 2025
f09e35e
[ruby/date] [ruby/date] Optimize Gregorian date conversions with Neri…
mensfeld Dec 18, 2025
ea03f26
[ruby/date] improve styling
mensfeld Dec 18, 2025
bcaa127
[ruby/date] code remarks, macros and r2.6 support
mensfeld Dec 18, 2025
5960fb9
[ruby/date] remove redundant code
mensfeld Dec 18, 2025
8024245
[ruby/date] remove conditional for uint64_t
mensfeld Dec 18, 2025
c5376a3
[ruby/rubygems] Remove deprecated, unused Gem::List
hsbt Dec 5, 2025
bdbe8d5
[ruby/rubygems] Write gem files atomically
eileencodes Nov 25, 2025
74becf1
Start to develop 4.1.0.dev
hsbt Dec 26, 2025
4b7bbd4
[ruby/resolv] Fix TCP Requester #recv_reply
jsaubry Oct 29, 2025
f8d0960
[ruby/resolv] Handle TCP Requester #recv_reply incomplete data
jsaubry Dec 8, 2025
44a1765
[ruby/timeout] add test case for string argument
t-mangoe Dec 21, 2025
f3149af
[ruby/prism] Sync `Prism::Translation::ParserCurrent` with Ruby 4.0
koic Dec 20, 2025
1f526b3
[ruby/ipaddr] Follow-up fix for InvalidAddressError messages
taketo1113 Dec 17, 2025
8ccfb37
[ruby/json] Update `fpconv_dtoa` definition to use `dest[32]`
nna774 Dec 18, 2025
4d7db86
[ruby/json] Add missing documentation for `allow_control_characters` …
byroot Dec 22, 2025
fda7019
[ruby/net-protocol] Add Net::Protocol::TCP_SOCKET_NEW_HAS_OPEN_TIMEOUT
eregon Dec 8, 2025
70c7f3a
[ruby/strscan] Bump version
kou Dec 17, 2025
93df966
Mark development version for unreleased gems
hsbt Dec 26, 2025
89af235
Added ruby_41? platform
hsbt Dec 26, 2025
565ea26
Disabled to run lobsters benchmark because it didn't work with Ruby 4…
hsbt Dec 26, 2025
e95a994
Update default gems list at 565ea26ad10ea8c3c6ce9bdae6cbb7 [ci skip]
matzbot Dec 26, 2025
02275b1
uutils-coreutils 0.5.0 has been removed uutils wrapper
hsbt Dec 26, 2025
9824724
Skip test_write_binary(GemSingletonTest) at rbs tests
hsbt Dec 26, 2025
594dd8b
[ruby/pp] Support private instance_variables_to_inspect
hamajyotan Dec 26, 2025
bad7dd5
[DOC] Separate updated gems lists into sections in NEWS.md
nobu Dec 26, 2025
b01fd2d
Fix RSET_IS_MEMBER macro parameter mismatch
afurm Dec 25, 2025
704ac72
Clarify the intent of the test for "ruby -h" to fit in 80x25
mame Dec 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ jobs:
path: ruby-bench

- name: Run ruby-bench
run: ruby run_benchmarks.rb -e "ruby::../build/install/bin/ruby" ${{ matrix.bench_opts }}
run: rm -rf benchmarks/lobsters && ruby run_benchmarks.rb -e "ruby::../build/install/bin/ruby" ${{ matrix.bench_opts }}
working-directory: ruby-bench

- uses: ./.github/actions/slack
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:
# https://github.com/actions/virtual-environments/issues/712#issuecomment-613004302
run: |
::- Set up VC ${{ matrix.vc }}
set | uutils sort > old.env
set | sort > old.env
call ..\src\win32\vssetup.cmd ^
-arch=${{ matrix.target || 'amd64' }} ^
${{ matrix.vcvars && '-vcvars_ver=' || '' }}${{ matrix.vcvars }}
Expand All @@ -122,8 +122,8 @@ jobs:
set MAKEFLAGS=l
set /a TEST_JOBS=(15 * %NUMBER_OF_PROCESSORS% / 10) > nul
set RUBY_OPT_DIR=%GITHUB_WORKSPACE:\=/%/src/vcpkg_installed/%VCPKG_DEFAULT_TRIPLET%
set | uutils sort > new.env
uutils comm -13 old.env new.env >> %GITHUB_ENV%
set | sort > new.env
comm -13 old.env new.env >> %GITHUB_ENV%
del *.env
- name: baseruby version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/zjit-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ jobs:
path: ruby-bench

- name: Run ruby-bench
run: ruby run_benchmarks.rb -e "zjit::../build/install/bin/ruby ${{ matrix.ruby_opts }}" ${{ matrix.bench_opts }}
run: rm -rf benchmarks/lobsters && ruby run_benchmarks.rb -e "zjit::../build/install/bin/ruby ${{ matrix.ruby_opts }}" ${{ matrix.bench_opts }}
working-directory: ruby-bench

- uses: ./.github/actions/slack
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/zjit-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ jobs:
path: ruby-bench

- name: Run ruby-bench
run: ruby run_benchmarks.rb -e "zjit::../build/install/bin/ruby ${{ matrix.ruby_opts }}" ${{ matrix.bench_opts }}
run: rm -rf benchmarks/lobsters && ruby run_benchmarks.rb -e "zjit::../build/install/bin/ruby ${{ matrix.ruby_opts }}" ${{ matrix.bench_opts }}
working-directory: ruby-bench

- uses: ./.github/actions/slack
Expand Down
12 changes: 8 additions & 4 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@ Other changes are listed in the following sections. We also listed release
history from the previous bundled version that is Ruby 3.4.0 if it has GitHub
releases.

The following bundled gems are promoted from default gems.
### The following bundled gems are promoted from default gems.

The following default gem is added.
### The following default gem is added.

The following default gems are updated.
### The following default gems are updated.

* RubyGems 4.1.0.dev
* bundler 4.1.0.dev
* stringio 3.2.1.dev
* strscan 3.1.7.dev

The following bundled gems are updated.
### The following bundled gems are updated.

### RubyGems and Bundler

Expand Down
65 changes: 65 additions & 0 deletions doc/stringio/pread.rdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
**Note**: \Method +pread+ is different from other reading methods
in that it does not modify +self+ in any way;
thus, multiple threads may read safely from the same stream.

Reads up to +maxlen+ bytes from the stream,
beginning at 0-based byte offset +offset+;
returns a string containing the read bytes.

The returned string:

- Contains +maxlen+ bytes from the stream, if available;
otherwise contains all available bytes.
- Has encoding +Encoding::ASCII_8BIT+.

With only arguments +maxlen+ and +offset+ given,
returns a new string:

english = 'Hello' # Five 1-byte characters.
strio = StringIO.new(english)
strio.pread(3, 0) # => "Hel"
strio.pread(3, 2) # => "llo"
strio.pread(0, 0) # => ""
strio.pread(50, 0) # => "Hello"
strio.pread(50, 2) # => "llo"
strio.pread(50, 4) # => "o"
strio.pread(0, 0).encoding
# => #<Encoding:BINARY (ASCII-8BIT)>

russian = 'Привет' # Six 2-byte characters.
strio = StringIO.new(russian)
strio.pread(50, 0) # All 12 bytes.
# => "\xD0\x9F\xD1\x80\xD0\xB8\xD0\xB2\xD0\xB5\xD1\x82"
strio.pread(3, 0) # => "\xD0\x9F\xD1"
strio.pread(3, 3) # => "\x80\xD0\xB8"
strio.pread(0, 0).encoding
# => #<Encoding:BINARY (ASCII-8BIT)>

japanese = 'こんにちは' # Five 3-byte characters.
strio = StringIO.new(japanese)
strio.pread(50, 0) # All 15 bytes.
# => "\xE3\x81\x93\xE3\x82\x93\xE3\x81\xAB\xE3\x81\xA1\xE3\x81\xAF"
strio.pread(6, 0) # => "\xE3\x81\x93\xE3\x82\x93"
strio.pread(1, 2) # => "\x93"
strio.pread(0, 0).encoding
# => #<Encoding:BINARY (ASCII-8BIT)>

Raises an exception if +offset+ is out-of-range:

strio = StringIO.new(english)
strio.pread(5, 50) # Raises EOFError: end of file reached

With string argument +out_string+ given:

- Reads as above.
- Overwrites the content of +out_string+ with the read bytes.

Examples:

out_string = 'Will be overwritten'
out_string.encoding # => #<Encoding:UTF-8>
result = StringIO.new(english).pread(50, 0, out_string)
result.__id__ == out_string.__id__ # => true
out_string # => "Hello"
out_string.encoding # => #<Encoding:BINARY (ASCII-8BIT)>

82 changes: 82 additions & 0 deletions doc/stringio/putc.rdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
Replaces one or more bytes at position +pos+
with bytes of the given argument;
advances the position by the count of bytes written;
returns the argument.

\StringIO object for 1-byte characters.

strio = StringIO.new('foo')
strio.pos # => 0

With 1-byte argument, replaces one byte:

strio.putc('b')
strio.string # => "boo"
strio.pos # => 1
strio.putc('a') # => "a"
strio.string # => "bao"
strio.pos # => 2
strio.putc('r') # => "r"
strio.string # => "bar"
strio.pos # => 3
strio.putc('n') # => "n"
strio.string # => "barn"
strio.pos # => 4

Fills with null characters if necessary:

strio.pos = 6
strio.putc('x') # => "x"
strio.string # => "barn\u0000\u0000x"
strio.pos # => 7

With integer argument, replaces one byte with the low-order byte of the integer:

strio = StringIO.new('foo')
strio.putc(70)
strio.string # => "Foo"
strio.putc(79)
strio.string # => "FOo"
strio.putc(79 + 1024)
strio.string # => "FOO"

\StringIO object for Multi-byte characters:

greek = 'αβγδε' # Five 2-byte characters.
strio = StringIO.new(greek)
strio.string# => "αβγδε"
strio.string.b # => "\xCE\xB1\xCE\xB2\xCE\xB3\xCE\xB4\xCE\xB5"
strio.string.bytesize # => 10
strio.string.chars # => ["α", "β", "γ", "δ", "ε"]
strio.string.size # => 5

With 1-byte argument, replaces one byte of the string:

strio.putc(' ') # 1-byte ascii space.
strio.pos # => 1
strio.string # => " \xB1βγδε"
strio.string.b # => " \xB1\xCE\xB2\xCE\xB3\xCE\xB4\xCE\xB5"
strio.string.bytesize # => 10
strio.string.chars # => [" ", "\xB1", "β", "γ", "δ", "ε"]
strio.string.size # => 6

strio.putc(' ')
strio.pos # => 2
strio.string # => " βγδε"
strio.string.b # => " \xCE\xB2\xCE\xB3\xCE\xB4\xCE\xB5"
strio.string.bytesize # => 10
strio.string.chars # => [" ", " ", "β", "γ", "δ", "ε"]
strio.string.size # => 6

With 2-byte argument, replaces two bytes of the string:

strio.rewind
strio.putc('α')
strio.pos # => 2
strio.string # => "αβγδε"
strio.string.b # => "\xCE\xB1\xCE\xB2\xCE\xB3\xCE\xB4\xCE\xB5"
strio.string.bytesize # => 10
strio.string.chars # => ["α", "β", "γ", "δ", "ε"]
strio.string.size # => 5

Related: #getc, #ungetc.
83 changes: 83 additions & 0 deletions doc/stringio/read.rdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
Reads and returns a string containing bytes read from the stream,
beginning at the current position;
advances the position by the count of bytes read.

With no arguments given,
reads all remaining bytes in the stream;
returns a new string containing bytes read:

strio = StringIO.new('Hello') # Five 1-byte characters.
strio.read # => "Hello"
strio.pos # => 5
strio.read # => ""
StringIO.new('').read # => ""

With non-negative argument +maxlen+ given,
reads +maxlen+ bytes as available;
returns a new string containing the bytes read, or +nil+ if none:

strio.rewind
strio.read(3) # => "Hel"
strio.read(3) # => "lo"
strio.read(3) # => nil

russian = 'Привет' # Six 2-byte characters.
russian.b
# => "\xD0\x9F\xD1\x80\xD0\xB8\xD0\xB2\xD0\xB5\xD1\x82"
strio = StringIO.new(russian)
strio.read(6) # => "\xD0\x9F\xD1\x80\xD0\xB8"
strio.read(6) # => "\xD0\xB2\xD0\xB5\xD1\x82"
strio.read(6) # => nil

japanese = 'こんにちは'
japanese.b
# => "\xE3\x81\x93\xE3\x82\x93\xE3\x81\xAB\xE3\x81\xA1\xE3\x81\xAF"
strio = StringIO.new(japanese)
strio.read(9) # => "\xE3\x81\x93\xE3\x82\x93\xE3\x81\xAB"
strio.read(9) # => "\xE3\x81\xA1\xE3\x81\xAF"
strio.read(9) # => nil

With argument +max_len+ as +nil+ and string argument +out_string+ given,
reads the remaining bytes in the stream;
clears +out_string+ and writes the bytes into it;
returns +out_string+:

out_string = 'Will be overwritten'
strio = StringIO.new('Hello')
strio.read(nil, out_string) # => "Hello"
strio.read(nil, out_string) # => ""

With non-negative argument +maxlen+ and string argument +out_string+ given,
reads the +maxlen bytes from the stream, as availble;
clears +out_string+ and writes the bytes into it;
returns +out_string+ if any bytes were read, or +nil+ if none:

out_string = 'Will be overwritten'
strio = StringIO.new('Hello')
strio.read(3, out_string) # => "Hel"
strio.read(3, out_string) # => "lo"
strio.read(3, out_string) # => nil

out_string = 'Will be overwritten'
strio = StringIO.new(russian)
strio.read(6, out_string) # => "При"
strio.read(6, out_string) # => "вет"
strio.read(6, out_string) # => nil
strio.rewind
russian.b
# => "\xD0\x9F\xD1\x80\xD0\xB8\xD0\xB2\xD0\xB5\xD1\x82"
strio.read(3) # => "\xD0\x9F\xD1"
strio.read(3) # => "\x80\xD0\xB8"

out_string = 'Will be overwritten'
strio = StringIO.new(japanese)
strio.read(9, out_string) # => "こんに"
strio.read(9, out_string) # => "ちは"
strio.read(9, out_string) # => nil
strio.rewind
japanese.b
# => "\xE3\x81\x93\xE3\x82\x93\xE3\x81\xAB\xE3\x81\xA1\xE3\x81\xAF"
strio.read(4) # => "\xE3\x81\x93\xE3"
strio.read(4) # => "\x82\x93\xE3\x81"

Related: #gets, #readlines.
Loading