Sha256: 16edab0243c2f2986ab2000c1ca11237f577e6bbf80cf0595e0d729ba0245497

Contents?: true

Size: 979 Bytes

Versions: 6937

Compression:

Stored size: 979 Bytes

Contents

module RSpec
  module Core
    # @private
    #
    # We use this to replace `::Set` so we can have the advantage of
    # constant time key lookups for unique arrays but without the
    # potential to pollute a developers environment with an extra
    # piece of the stdlib. This helps to prevent false positive
    # builds.
    #
    class Set
      include Enumerable

      def initialize(array=[])
        @values = {}
        merge(array)
      end

      def empty?
        @values.empty?
      end

      def <<(key)
        @values[key] = true
        self
      end

      def delete(key)
        @values.delete(key)
      end

      def each(&block)
        @values.keys.each(&block)
        self
      end

      def include?(key)
        @values.key?(key)
      end

      def merge(values)
        values.each do |key|
          @values[key] = true
        end
        self
      end

      def clear
        @values.clear
        self
      end
    end
  end
end

Version data entries

6,937 entries across 6,867 versions & 100 rubygems

Version Path
cybrid_api_id_ruby-0.123.3 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/set.rb
cybrid_api_id_ruby-0.123.2 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/set.rb
cybrid_api_bank_ruby-0.123.2 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/set.rb
cybrid_api_organization_ruby-0.123.2 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/set.rb
cybrid_api_bank_ruby-0.122.72 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/set.rb
cybrid_api_organization_ruby-0.122.72 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/set.rb
cybrid_api_id_ruby-0.122.72 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/set.rb
cybrid_api_bank_ruby-0.122.71 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/set.rb
cybrid_api_id_ruby-0.122.71 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/set.rb
cybrid_api_organization_ruby-0.122.71 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/set.rb
cybrid_api_bank_ruby-0.122.70 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/set.rb
cybrid_api_organization_ruby-0.122.70 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/set.rb
cybrid_api_id_ruby-0.122.70 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/set.rb
cybrid_api_bank_ruby-0.122.69 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/set.rb
cybrid_api_id_ruby-0.122.69 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/set.rb
cybrid_api_organization_ruby-0.122.69 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/set.rb
cybrid_api_organization_ruby-0.122.68 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/set.rb
cybrid_api_bank_ruby-0.122.68 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/set.rb
cybrid_api_id_ruby-0.122.68 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/set.rb
cybrid_api_bank_ruby-0.122.67 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/set.rb