/usr/lib/ruby/vendor_ruby/rspec/core/set.rb is in ruby-rspec-core 3.7.0c1e0m0s1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | 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
|