Sha256: 44ab9a8da4cc99172fd10f5d4b44947211f983da2266b67ea63491c5e2836b9f
Contents?: true
Size: 1.1 KB
Versions: 2
Compression:
Stored size: 1.1 KB
Contents
require "twirl/instrumenters/noop" module Twirl class Item # Public: The key of the item. attr_reader :key # Public: The value of the item. attr_reader :value # Private: The client that popped the item. attr_reader :client def initialize(key, value, client, instrumenter = nil) @key = key @value = value @client = client @instrumenter = instrumenter || Instrumenters::Noop end # Public: Acknowledge that we are done processing the item. def close @instrumenter.instrument "op.twirl" do |payload| payload[:op] = :item_close payload[:queue_name] = @key @client.close @key end end # Public: Something went wrong processing. def abort @instrumenter.instrument "op.twirl" do |payload| payload[:op] = :item_abort payload[:queue_name] = @key @client.abort @key end end def eql?(other) self.class.eql?(other.class) && @key == other.key && @value == other.value && @client == other.client end alias_method :==, :eql? end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
twirl-0.2.0 | lib/twirl/item.rb |
twirl-0.1.0 | lib/twirl/item.rb |