Sha256: e99e33219bc7befadd5ab3e25cc2444282eaf95acd9b67b719d3ef7ee8b7c588

Contents?: true

Size: 743 Bytes

Versions: 31

Compression:

Stored size: 743 Bytes

Contents

# frozen_string_literal: true

module Bullet
  module Registry
    class Base
      attr_reader :registry

      def initialize
        @registry = {}
      end

      def [](key)
        @registry[key]
      end

      def each(&block)
        @registry.each(&block)
      end

      def delete(base)
        @registry.delete(base)
      end

      def select(*args, &block)
        @registry.select(*args, &block)
      end

      def add(key, value)
        @registry[key] ||= Set.new
        if value.is_a? Array
          @registry[key] += value
        else
          @registry[key] << value
        end
      end

      def include?(key, value)
        !@registry[key].nil? && @registry[key].include?(value)
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
bullet-8.0.0 lib/bullet/registry/base.rb
bullet-7.2.0 lib/bullet/registry/base.rb
bullet-7.1.6 lib/bullet/registry/base.rb
bullet-7.1.5 lib/bullet/registry/base.rb
bullet-7.1.4 lib/bullet/registry/base.rb
bullet-7.1.3 lib/bullet/registry/base.rb
bullet-7.1.2 lib/bullet/registry/base.rb
bullet-7.1.1 lib/bullet/registry/base.rb
bullet-7.1.0 lib/bullet/registry/base.rb
bullet-7.0.7 lib/bullet/registry/base.rb
bullet-7.0.6 lib/bullet/registry/base.rb
bullet-7.0.5 lib/bullet/registry/base.rb
bullet-7.0.4 lib/bullet/registry/base.rb
bullet-7.0.3 lib/bullet/registry/base.rb
bullet-7.0.2 lib/bullet/registry/base.rb
bullet-7.0.1 lib/bullet/registry/base.rb
bullet-7.0.0 lib/bullet/registry/base.rb
bullet-6.1.5 lib/bullet/registry/base.rb
bullet-6.1.4 lib/bullet/registry/base.rb
bullet-6.1.3 lib/bullet/registry/base.rb