simplify Dir.glob
This commit is contained in:
parent
46b62a54d9
commit
3b6eb053de
@ -1,12 +1,7 @@
|
|||||||
module FakeFS
|
module FakeFS
|
||||||
class Dir
|
class Dir
|
||||||
def self.glob(pattern)
|
def self.glob(pattern)
|
||||||
if pattern[-1,1] == '*'
|
[FileSystem.find(pattern) || []].flatten.map{|e| e.to_s}.sort
|
||||||
blk = proc { |entry| entry.to_s }
|
|
||||||
else
|
|
||||||
blk = proc { |entry| entry[1].parent.to_s }
|
|
||||||
end
|
|
||||||
(FileSystem.find(pattern) || []).map(&blk).uniq.sort
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.[](pattern)
|
def self.[](pattern)
|
||||||
|
Loading…
Reference in New Issue
Block a user