Class: RSpec::Core::Set Private
Do not use. This class is for internal use only.
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
self,
Enumerable
|
|
Inherits: | Object |
Defined in: | rspec-core/lib/rspec/core/set.rb |
Overview
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 Method Summary
- .new(array = []) ⇒ Set constructor Internal use only
Instance Attribute Summary
- #empty? ⇒ Boolean readonly Internal use only
Instance Method Summary
- #<<(key) Internal use only
- #clear Internal use only
- #delete(key) Internal use only
- #each(&block) Internal use only
- #include?(key) ⇒ Boolean Internal use only
- #merge(values) Internal use only
Instance Attribute Details
#empty? ⇒ Boolean
(readonly)
# File 'rspec-core/lib/rspec/core/set.rb', line 19
def empty? @values.empty? end
Instance Method Details
#<<(key)
[ GitHub ]# File 'rspec-core/lib/rspec/core/set.rb', line 23
def <<(key) @values[key] = true self end
#clear
[ GitHub ]# File 'rspec-core/lib/rspec/core/set.rb', line 48
def clear @values.clear self end
#delete(key)
[ GitHub ]# File 'rspec-core/lib/rspec/core/set.rb', line 28
def delete(key) @values.delete(key) end
#each(&block)
[ GitHub ]# File 'rspec-core/lib/rspec/core/set.rb', line 32
def each(&block) @values.keys.each(&block) self end
#include?(key) ⇒ Boolean
# File 'rspec-core/lib/rspec/core/set.rb', line 37
def include?(key) @values.key?(key) end
#merge(values)
[ GitHub ]# File 'rspec-core/lib/rspec/core/set.rb', line 41
def merge(values) values.each do |key| @values[key] = true end self end