diff --git a/lib/fakefs/dir.rb b/lib/fakefs/dir.rb index 2944894..c5ac3ea 100644 --- a/lib/fakefs/dir.rb +++ b/lib/fakefs/dir.rb @@ -51,7 +51,7 @@ module FakeFS @pointer = integer @contents[integer] end - + def self.[](pattern) glob(pattern) end @@ -66,7 +66,7 @@ module FakeFS def self.delete(string) raise SystemCallError, "No such file or directory - #{string}" unless FileSystem.find(string).values.empty? - FileSystem.delete(string) + FileSystem.delete(string) end def self.entries(dirname) @@ -77,7 +77,7 @@ module FakeFS def self.foreach(dirname, &block) Dir.open(dirname) { |file| yield file } end - + def self.glob(pattern) [FileSystem.find(pattern) || []].flatten.map{|e| e.to_s}.sort end diff --git a/lib/fakefs/file_system.rb b/lib/fakefs/file_system.rb index be7d53a..f24a50b 100644 --- a/lib/fakefs/file_system.rb +++ b/lib/fakefs/file_system.rb @@ -22,9 +22,9 @@ module FakeFS def find(path) parts = path_parts(normalize_path(path)) return fs if parts.empty? # '/' - + entries = find_recurser(fs, parts).flatten - + case entries.length when 0 then nil when 1 then entries.first @@ -113,6 +113,6 @@ module FakeFS else matches.map{|entry| find_recurser(entry, parts) } end - end + end end end diff --git a/lib/fakefs/fileutils.rb b/lib/fakefs/fileutils.rb index fd75a20..b1532b5 100644 --- a/lib/fakefs/fileutils.rb +++ b/lib/fakefs/fileutils.rb @@ -21,7 +21,7 @@ module FakeFS def rm(path) FileSystem.delete(path) end - + alias_method :rm_rf, :rm alias_method :rm_r, :rm