Sha256: daa79a7923ced01632ac8c5bdff64b54d636b36b9492b011f36dafa000370dfb

Contents?: true

Size: 706 Bytes

Versions: 18

Compression:

Stored size: 706 Bytes

Contents

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] && @registry[key].include?(value)
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
bullet-4.7.1 lib/bullet/registry/base.rb
bullet-4.7.0 lib/bullet/registry/base.rb
bullet-4.6.0 lib/bullet/registry/base.rb
bullet-4.5.0 lib/bullet/registry/base.rb
bullet-4.4.0 lib/bullet/registry/base.rb
bullet-4.3.1 lib/bullet/registry/base.rb
bullet-4.3.0 lib/bullet/registry/base.rb
bullet-4.2.0 lib/bullet/registry/base.rb
bullet-4.1.6 lib/bullet/registry/base.rb
bullet-4.1.5 lib/bullet/registry/base.rb
bullet-4.1.4 lib/bullet/registry/base.rb
bullet-4.1.3 lib/bullet/registry/base.rb
bullet-4.1.2 lib/bullet/registry/base.rb
bullet-4.1.1 lib/bullet/registry/base.rb
bullet-4.1.0 lib/bullet/registry/base.rb
bullet-4.0.0 lib/bullet/registry/base.rb
bullet-2.3.1 lib/bullet/registry/base.rb
bullet-2.3.0 lib/bullet/registry/base.rb