Repository navigation
Add an equivalent of river.WorkFunc for Ruby - #1486
Merged
Merged
Conversation
Contributor
Author
|
@bgentry This one's not a big deal, but just happened to notice it while manual inspecting docs. |
bgentry
approved these changes
Oct 9, 2026
bgentry
left a comment
Contributor
There was a problem hiding this comment.
Huh, not sure if this can some how be conformance tested but it'd be nice to ensure we have comparable feature sets across the ports.
Just noticed while doing a manual review on docs changes that Ruby
doesn't have an equivalent to Go's `river.WorkFunc` whereas the rest of
the languages do.
Here, let `workers.add` take a kind and closure:
workers.add(:send_message) do |job|
puts "Message: #{job.args.fetch("message")}"
end
Insertions would have to come from another language or use JobArgsHash:
client.insert River::JobArgsHash.new(:send_message, message: "Hello!")
This admittedly isn't a huge improvement, but I think it's probably
worth doing just because both Rust and TypeScript have something
extremely similar. This puts all languages on equal footing.
Here, add one in. It's arguable as to whether it adds all that much
compared to a normal class which is already pretty terse, but it does
let you
brandur
force-pushed
the
brandur-ruby-work-func
branch
from
October 10, 2026 04:24
25d412e to
a234416
Compare
Contributor
Author
|
thx!
Yeah, maybe something we can figure out. That said, I think once we get a couple passes in to pick up any of these omissions, they're pretty unlikely to regress. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Just noticed while doing a manual review on docs changes that Ruby
doesn't have an equivalent to Go's
river.WorkFuncwhereas the rest ofthe languages do.
Here, let
workers.addtake a kind and closure:Insertions would have to come from another language or use JobArgsHash:
This admittedly isn't a huge improvement, but I think it's probably
worth doing just because both Rust and TypeScript have something
extremely similar. This puts all languages on equal footing.
Here, add one in. It's arguable as to whether it adds all that much
compared to a normal class which is already pretty terse, but it does
let you