Sha256: 0d09a9a0b3a4fd91054d09cc641ed987b93de93315fa03e2b86de04f9b5c672a

Contents?: true

Size: 568 Bytes

Versions: 3

Compression:

Stored size: 568 Bytes

Contents

# frozen_string_literal: true

module Ikibana
  module Consumer
    def self.included(mod)
      mod.extend self
      mod.extend ClassMethods
      mod.include ClassMethods
    end

    module ClassMethods
      def at_most_once
        cache.write("#{self}_locked", true)
      end

      def sync(...)
        cache.write("#{self}_locked", false)
        cache.write("#{self}_sync", true)
      end

      def destructor(...)
        cache.write("#{self}_locked", false)
      end

      def cache
        Ikibana::Config.instance.cache
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ikibana-0.1.2 lib/ikibana/consumer.rb
ikibana-0.1.1 lib/ikibana/consumer.rb
ikibana-0.1.0 lib/ikibana/consumer.rb