Module: Rake::Funnel::Extensions::CommonPath

Included in:
Array, Rake::FileList
Defined in:
lib/rake/funnel/extensions/common_path.rb

Instance Method Summary collapse

Instance Method Details

#common_pathObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/rake/funnel/extensions/common_path.rb', line 8

def common_path
  list = to_a
    .compact
    .map { |x| components(x) }

  min = list.min_by(&:length)

  matches = find_matches(list, min)
  matches.min_by(&:length) || ''
end