Class: ReaPack::Index::ConflictDetector::Selector
- Inherits:
-
Object
- Object
- ReaPack::Index::ConflictDetector::Selector
- Defined in:
- lib/reapack/index/cdetector.rb
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize(key, cdetector) ⇒ Selector
constructor
A new instance of Selector.
- #push(bucket, platform, file) ⇒ Object
- #resolve ⇒ Object
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
#clear ⇒ Object
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 |
#resolve ⇒ Object
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 |