Sha256: 8a36fad7916bb891f0fe1569bef0fd27c8de0f4cd22891a5b58c071884275210
Contents?: true
Size: 963 Bytes
Versions: 2
Compression:
Stored size: 963 Bytes
Contents
# -*- encoding: utf-8 -*- module GitShizzle::IndexSpecifications class Combined def initialize(specs) @specs = specs end def include?(index) index = humanize index @specs.any? do |spec| spec.include? index end end def register_match(index) index = humanize index @specs.each do |spec| spec.register_match index end end def unmatched [] end def apply(files) result = files.each_with_index.map do |element, index| next unless include? index register_match index element end.compact unmatched_indexes = @specs.map do |spec| spec.unmatched end.flatten.compact.uniq.sort raise IndexSpecificationError.new(unmatched_indexes) if unmatched_indexes.any? result end private def humanize(index) index + 1 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
git_shizzle-0.2.8 | lib/git_shizzle/index_specifications/combined.rb |
git_shizzle-0.2.6 | lib/git_shizzle/index_specifications/combined.rb |