Sha256: eac66c026fee41a3026bda42823fbc9d4a73742800f6cc05b11168fac4f0a8a9

Contents?: true

Size: 433 Bytes

Versions: 10

Compression:

Stored size: 433 Bytes

Contents

module Ruboty
  module Ragoon
    module NotifyOnce
      def not_notified_ids(new_item_ids)
        notified_item_ids = self.brain.data[brain_key] || []
        notified_item_ids &= new_item_ids
        self.brain.data[brain_key] = notified_item_ids + new_item_ids
        new_item_ids - notified_item_ids
      end

      def brain_key
        "#{self.class.name.downcase.gsub('::', '_')}_notified_ids"
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ruboty-ragoon-1.1.0 lib/ruboty/ragoon/notify_once.rb
ruboty-ragoon-1.0.0 lib/ruboty/ragoon/notify_once.rb
ruboty-ragoon-0.8.1 lib/ruboty/ragoon/notify_once.rb
ruboty-ragoon-0.8.0 lib/ruboty/ragoon/notify_once.rb
ruboty-ragoon-0.7.0 lib/ruboty/ragoon/notify_once.rb
ruboty-ragoon-0.6.1 lib/ruboty/ragoon/notify_once.rb
ruboty-ragoon-0.6.0 lib/ruboty/ragoon/notify_once.rb
ruboty-ragoon-0.5.2 lib/ruboty/ragoon/notify_once.rb
ruboty-ragoon-0.5.1 lib/ruboty/ragoon/notify_once.rb
ruboty-ragoon-0.5.0 lib/ruboty/ragoon/notify_once.rb