Module: Hyde::PatternMatching

Defined in:
lib/hyde/pattern_matching.rb,
lib/hyde/pattern_matching/glob.rb,
lib/hyde/pattern_matching/util.rb,
lib/hyde/pattern_matching/rematch.rb

Overview

Utility functions and pattern-generator classes. Used primarily to create patterns for path definitions.

Defined Under Namespace

Classes: Glob, ReMatch

Class Method Summary collapse

Class Method Details

.canonicalize(string) ⇒ String

Strips extra slashes from a string. (including slashes at the start and end of the string)

Parameters:

  • string (String)

Returns:

  • (String)


9
10
11
12
13
# File 'lib/hyde/pattern_matching/util.rb', line 9

def self.canonicalize(string)
  string.gsub(/\/+/, "/")
        .delete_prefix("/")
        .delete_suffix("/")
end