# frozen_string_literal: true module Wayfarer class Task include Stringify attr_reader :url, :batch, :metadata stringify :url, :batch def initialize(url, batch) @url = url @batch = batch @metadata = OpenStruct.new end def ==(other) [url, batch] == [other.url, other.batch] end def barrier @barrier ||= Wayfarer::Redis::Barrier.new(batch) end def counter @counter ||= Wayfarer::Redis::Counter.new(batch) end def gc @gc ||= Wayfarer::GC.new(self) end end end