Class: ReaPack::Index::ConflictDetector::Selector

Inherits:
Object
  • Object
show all
Defined in:
lib/reapack/index/cdetector.rb

Instance Method Summary collapse

Constructor Details

#initialize(key, cdetector) ⇒ Selector

Returns a new instance of Selector.



6
7
8
# File 'lib/reapack/index/cdetector.rb', line 6

def initialize(key, cdetector)
  @key, @cdetector = key, cdetector
end

Instance Method Details

#clearObject



14
15
16
17
18
# File 'lib/reapack/index/cdetector.rb', line 14

def clear
  @cdetector.buckets.each_value do |b|
    b.reject! {|e| e.key == @key }
  end
end

#push(bucket, platform, file) ⇒ Object



10
11
12
# File 'lib/reapack/index/cdetector.rb', line 10

def push(bucket, platform, file)
  @cdetector.bucket(bucket) << Entry.new(@key, platform, file).freeze
end

#resolveObject



20
21
22
23
24
25
26
# File 'lib/reapack/index/cdetector.rb', line 20

def resolve
  errors = @cdetector.buckets.map do |b, _|
    @cdetector.resolve b, @key
  end.compact.flatten

  errors unless errors.empty?
end