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



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

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

.relative(pattern) ⇒ Object



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

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

Instance Method Details

#globObject



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

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.



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

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

#to_sObject



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

def to_s
  pathname.to_s
end