lib/opal/hike.rb
# Sorts candidate matches by their extension
# priority. Extensions in the front of the `extensions` carry
# more weight.
Sorts candidate matches by their extension
priority. Extensions in the front of the `extensions` carry
more weight.
Sorts candidate matches by their extension priority . Extensions in the front of the ` extensions ` carry more weight .
def sort_matches(matches, basename)
        matches.sort_by do |match|
          extnames = match.sub(basename.to_s, '').to_s.scan(/\.[^.]+/)
          extnames.inject(0) do |sum, ext|
            index = extensions.index(ext)
            if index
              sum + index + 1
            else
              sum
            end
          end
        end
      end
def sort_matches ( matches , basename ) matches . sort_by do | match | extnames = match . sub ( basename . to_s , '' ) . to_s . scan ( / \. [^.]+ / ) extnames . inject ( 0 ) do | sum , ext | index = extensions . index ( ext ) if index sum + index + 1 else sum end end end end
Sorts candidate matches by their extension
priority.
Sorts candidate matches by their extension priority .
matches
<not_specific>
basename
<not_specific>