whitespace

This commit is contained in:
Chris Wanstrath 2009-09-21 19:38:35 -07:00
parent a22f0c5ee6
commit 0124b3ab89
3 changed files with 7 additions and 7 deletions

View File

@ -51,7 +51,7 @@ module FakeFS
@pointer = integer @pointer = integer
@contents[integer] @contents[integer]
end end
def self.[](pattern) def self.[](pattern)
glob(pattern) glob(pattern)
end end
@ -66,7 +66,7 @@ module FakeFS
def self.delete(string) def self.delete(string)
raise SystemCallError, "No such file or directory - #{string}" unless FileSystem.find(string).values.empty? raise SystemCallError, "No such file or directory - #{string}" unless FileSystem.find(string).values.empty?
FileSystem.delete(string) FileSystem.delete(string)
end end
def self.entries(dirname) def self.entries(dirname)
@ -77,7 +77,7 @@ module FakeFS
def self.foreach(dirname, &block) def self.foreach(dirname, &block)
Dir.open(dirname) { |file| yield file } Dir.open(dirname) { |file| yield file }
end end
def self.glob(pattern) def self.glob(pattern)
[FileSystem.find(pattern) || []].flatten.map{|e| e.to_s}.sort [FileSystem.find(pattern) || []].flatten.map{|e| e.to_s}.sort
end end

View File

@ -22,9 +22,9 @@ module FakeFS
def find(path) def find(path)
parts = path_parts(normalize_path(path)) parts = path_parts(normalize_path(path))
return fs if parts.empty? # '/' return fs if parts.empty? # '/'
entries = find_recurser(fs, parts).flatten entries = find_recurser(fs, parts).flatten
case entries.length case entries.length
when 0 then nil when 0 then nil
when 1 then entries.first when 1 then entries.first
@ -113,6 +113,6 @@ module FakeFS
else else
matches.map{|entry| find_recurser(entry, parts) } matches.map{|entry| find_recurser(entry, parts) }
end end
end end
end end
end end

View File

@ -21,7 +21,7 @@ module FakeFS
def rm(path) def rm(path)
FileSystem.delete(path) FileSystem.delete(path)
end end
alias_method :rm_rf, :rm alias_method :rm_rf, :rm
alias_method :rm_r, :rm alias_method :rm_r, :rm