Class: Puppet::FileSystem::PathPattern

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/file_system/path_pattern.rb

Direct Known Subclasses

AbsolutePathPattern, RelativePathPattern

Defined Under Namespace

Classes: InvalidPattern

Constant Summary collapse

TRAVERSAL =
/^\.\.$/
ABSOLUTE_UNIX =
/^\//
ABSOLUTE_WINDOWS =
/^[a-z]:/i
CURRENT_DRIVE_RELATIVE_WINDOWS =

ABSOLUT_VODKA #notappearinginthisclass

/^\\/

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.absolute(pattern) ⇒ Object



18
19
20
# File 'lib/puppet/file_system/path_pattern.rb', line 18

def self.absolute(pattern)
  AbsolutePathPattern.new(pattern)
end

.relative(pattern) ⇒ Object



14
15
16
# File 'lib/puppet/file_system/path_pattern.rb', line 14

def self.relative(pattern)
  RelativePathPattern.new(pattern)
end

Instance Method Details

#globObject



34
35
36
# File 'lib/puppet/file_system/path_pattern.rb', line 34

def glob
  Dir.glob(pathname.to_s)
end

#prefix_with(prefix) ⇒ AbsolutePathPattern

Returns A new AbsolutePathPattern prepended with the passed prefix’s pattern.

Parameters:

Returns:

  • (AbsolutePathPattern)

    A new AbsolutePathPattern prepended with the passed prefix’s pattern.



29
30
31
32
# File 'lib/puppet/file_system/path_pattern.rb', line 29

def prefix_with(prefix)
  new_pathname = prefix.pathname + pathname
  self.class.absolute(new_pathname.to_s)
end

#to_sObject



38
39
40
# File 'lib/puppet/file_system/path_pattern.rb', line 38

def to_s
  pathname.to_s
end