Skip to content

Commit

Permalink
Adding a Dir.glob method, only for Ruby 1.8.5
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhjk committed Mar 8, 2009
1 parent 7a0b5d8 commit 7790de7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions chef/lib/chef.rb
Expand Up @@ -36,3 +36,17 @@ def fatal!(msg, err = -1)
end
end
end

# Adds a Dir.glob to Ruby 1.8.5, for compat
if RUBY_VERSION < "1.8.6"
class Dir
class << self
alias_method :glob_, :glob
def glob(*args)
raise ArgumentError if args.empty?
args.inject([]) { |r, p| r + glob_(p) }
end
alias_method :[], :glob
end
end
end

0 comments on commit 7790de7

Please sign in to comment.