Module: Wurk::API::Fast::SortedSetExt
- Included in:
- SortedSet
- Defined in:
- lib/wurk/api/fast.rb
Overview
Extension to Wurk::SortedSet / JobSet. The base scan(match, count)
already yields (value, score) pairs via ZSCAN — Pro promotes the
surface to yield JobRecord directly so callers can entry.delete
/ entry.retry without re-parsing JSON.
The new behavior is enabled by block arity: a 1-arg block (or
block.lambda? + a 1-param signature) receives JobRecord; legacy
2-arg blocks (|value, score|) keep the raw shape. This preserves
the existing two-arg contract used by JobSet#find_job internally.
Instance Method Summary collapse
Instance Method Details
#scan(match, count = 100, &block) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/wurk/api/fast.rb', line 61 def scan(match, count = 100, &block) return enum_for(:scan, match, count) unless block if block.arity == 1 super do |value, score| block.call(Wurk::SortedEntry.new(self, score, value)) end else super end end |