Class: Jinx::Resource::Matcher
Overview
Matches the given targets to sources using #match_in.
Instance Method Summary collapse
Instance Method Details
#match(sources, targets) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/jinx/resource/matcher.rb', line 6 def match(sources, targets) unmatched = Set === sources ? sources.dup : sources.to_set matches = {} targets.each do |tgt| src = tgt.match_in(unmatched) if src then unmatched.delete(src) matches[src] = tgt end end matches end |