Class: Dir

Inherits:
Object show all
Defined in:
lib/chef/monkey_patches/dir.rb

Class Method Summary collapse

Class Method Details

.glob(pattern, flags = 0) ⇒ Object Also known as: []

Adds a Dir.glob to Ruby 1.8.5, for compat

Raises:

  • (ArgumentError)

24
25
26
27
28
29
30
31
32
# File 'lib/chef/monkey_patches/dir.rb', line 24

def glob(pattern, flags=0)
  raise ArgumentError unless (
    !pattern.nil? and (
      pattern.is_a? Array and !pattern.empty?
    ) or pattern.is_a? String
  )
  pattern.gsub!(/\\/, "/") if RUBY_PLATFORM =~ /mswin|mingw32|windows/
  [pattern].flatten.inject([]) { |r, p| r + glob_(p, flags) }
end

.glob_Object


22
# File 'lib/chef/monkey_patches/dir.rb', line 22

alias_method :glob_, :glob