Replace custom collection with Set
The original constraints that led to using a custom collection rather than Array or Set here no longer exist, so let's avoid the pointless abstraction here.
This commit is contained in:
parent
94bf0747b3
commit
7104e20bde
@ -21,29 +21,6 @@ class Compilers
|
||||
end
|
||||
|
||||
|
||||
class CompilerFailures
|
||||
include Enumerable
|
||||
|
||||
def initialize(*args)
|
||||
@failures = Array.new(*args)
|
||||
end
|
||||
|
||||
def each(*args, &block)
|
||||
@failures.each(*args, &block)
|
||||
end
|
||||
|
||||
def include?(cc)
|
||||
cc = Compiler.new(cc) unless cc.is_a? Compiler
|
||||
@failures.any? { |failure| failure.compiler == cc.name }
|
||||
end
|
||||
|
||||
def <<(o)
|
||||
@failures << o unless include? o.compiler
|
||||
self
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
class Compiler
|
||||
attr_reader :name, :build
|
||||
|
||||
|
||||
@ -785,12 +785,8 @@ private
|
||||
end
|
||||
|
||||
def fails_with compiler, &block
|
||||
@cc_failures ||= CompilerFailures.new
|
||||
@cc_failures << if block_given?
|
||||
CompilerFailure.new(compiler, &block)
|
||||
else
|
||||
CompilerFailure.new(compiler)
|
||||
end
|
||||
@cc_failures ||= Set.new
|
||||
@cc_failures << CompilerFailure.new(compiler, &block)
|
||||
end
|
||||
|
||||
def test &block
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user