Skip to content

Fix examples/sax_ractor.rb error#384

Merged
ohler55 merged 2 commits intoohler55:developfrom
Watson1978:example
Nov 4, 2025
Merged

Fix examples/sax_ractor.rb error#384
ohler55 merged 2 commits intoohler55:developfrom
Watson1978:example

Conversation

@Watson1978
Copy link
Copy Markdown
Contributor

This patch will fix following error:

$ ruby sax_ractor.rb /usr/share/mime/packages/freedesktop.org.xml image/jpeg font/ttf application/xhtml+xml image/x-pic
Parallel Ractors
#<Thread:0x00007fed255b7858 run> terminated with exception (report_on_exception is true):
#<Thread:0x00007fed2567fce0 run> terminated with exception (report_on_exception is true):
#<Thread:0x00007fed2567fa38 run> terminated with exception (report_on_exception is true):
#<Thread:0x00007fed2567f768 run> terminated with exception (report_on_exception is true):
#<Enumerator: ...>
/home/watson/.rbenv/versions/3.4.7/lib/ruby/gems/3.4.0/gems/ox-2.14.23/lib/ox/sax.rb:58:in 'initialize': wrong number of arguments (given 2, expected 0) (ArgumentError)
        from sax_ractor.rb:38:in 'Saxtor#initialize'
        from sax_ractor.rb:166:in 'Class#new'
        from sax_ractor.rb:166:in 'block (2 levels) in <main>'
/home/watson/.rbenv/versions/3.4.7/lib/ruby/gems/3.4.0/gems/ox-2.14.23/lib/ox/sax.rb:58:in 'initialize': ArgumentError
        from sax_ractor.rb:38:in 'Saxtor#initialize'
        from sax_ractor.rb:166:in 'Class#new'
        from sax_ractor.rb:166:in 'block (2 levels) in <main>'
/home/watson/.rbenv/versions/3.4.7/lib/ruby/gems/3.4.0/gems/ox-2.14.23/lib/ox/sax.rb:58:in 'initialize': ArgumentError
        from sax_ractor.rb:38:in 'Saxtor#initialize'
/home/watson/.rbenv/versions/3.4.7/lib/ruby/gems/3.4.0/gems/ox-2.14.23/lib/ox/sax.rb:58:in 'initialize' from sax_ractor.rb:166:in 'Class#new'
        from sax_ractor.rb:166:in 'block (2 levels) in <main>'
: ArgumentError
        from sax_ractor.rb:38:in 'Saxtor#initialize'
        from sax_ractor.rb:166:in 'Class#new'
        from sax_ractor.rb:166:in 'block (2 levels) in <main>'
sax_ractor.rb:182:in 'block in <main>': undefined method 'name' for an instance of Integer (NoMethodError)

  "#{_1.name} gave us #{_2 || 'nothing'}"
       ^^^^^
        from sax_ractor.rb:181:in 'Range#each'
        from sax_ractor.rb:181:in 'Enumerable#map'
        from sax_ractor.rb:181:in 'Enumerator#each'
        from sax_ractor.rb:181:in 'Enumerable#map'
        from sax_ractor.rb:181:in '<main>'

Applied this patch:

$ ruby sax_ractor.rb /usr/share/mime/packages/freedesktop.org.xml image/jpeg font/ttf application/xhtml+xml image/x-pic
Parallel Ractors
["Heifer 1 gave us JPEG-beeld (image/jpeg) [.jpg,.jpeg,.jpe,.jfif]",
 "Steer 1 gave us TrueType-skriftipe (font/ttf) [.ttf]",
 "Bull 1 gave us XHTML-bladsy (application/xhtml+xml) [.xhtml,.xht,.html,.htm]",
 "Steer 2 gave us nothing"]

Serial Ractor
"ONLY ONE OX gave us [#<CYO JPEG-beeld (image/jpeg) [.jpg,.jpeg,.jpe,.jfif]>, #<CYO TrueType-skriftipe (font/ttf) [.ttf]>, #<CYO XHTML-bladsy (application/xhtml+xml) [.xhtml,.xht,.html,.htm]>, #<CYO XHTML-bladsy (application/xhtml+xml) [.xhtml,.xht,.html,.htm]>]"

Comment thread examples/sax_ractor.rb
@ohler55 ohler55 merged commit 3ae12f2 into ohler55:develop Nov 4, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants