simplify Dir.glob

This commit is contained in:
Matt Freels 2009-07-28 00:22:24 -07:00
parent 46b62a54d9
commit 3b6eb053de

View File

@ -1,12 +1,7 @@
module FakeFS
class Dir
def self.glob(pattern)
if pattern[-1,1] == '*'
blk = proc { |entry| entry.to_s }
else
blk = proc { |entry| entry[1].parent.to_s }
end
(FileSystem.find(pattern) || []).map(&blk).uniq.sort
[FileSystem.find(pattern) || []].flatten.map{|e| e.to_s}.sort
end
def self.[](pattern)