Module: ErbHiera::Directory::Match

Defined in:
lib/erb-hiera/directory.rb

Class Method Summary collapse

Class Method Details

.path(path, regexp) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/erb-hiera/directory.rb', line 16

def self.path(path, regexp)
  result = path.match(regexp)

  if result.length != 2
    raise StandardError, "failed to match regexp for path: #{regexp}/#{path}"
  end

  result[1]
end