class RSpec::Core::Set
@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.
Public Class Methods
Source
# File lib/rspec/core/set.rb, line 14 def initialize(array=[]) @values = {} merge(array) end
Public Instance Methods
Source
# File lib/rspec/core/set.rb, line 32 def each(&block) @values.keys.each(&block) self end
Source
# File lib/rspec/core/set.rb, line 41 def merge(values) values.each do |key| @values[key] = true end self end