From 0fbdb455654fbfa7e09c128cac489d39bab53f17 Mon Sep 17 00:00:00 2001 From: Matt Freels Date: Tue, 28 Jul 2009 01:14:58 -0700 Subject: [PATCH] recurser should be private... --- lib/fakefs/file_system.rb | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/fakefs/file_system.rb b/lib/fakefs/file_system.rb index 8be0c5c..be7d53a 100644 --- a/lib/fakefs/file_system.rb +++ b/lib/fakefs/file_system.rb @@ -32,19 +32,6 @@ module FakeFS end end - def find_recurser(dir, parts) - return [] unless dir.respond_to? :[] - - pattern , *parts = parts - matches = dir.reject {|k,v| /\A#{pattern.gsub('?','.').gsub('*', '.*')}\Z/ !~ k }.values - - if parts.empty? # we're done recursing - matches - else - matches.map{|entry| find_recurser(entry, parts) } - end - end - def add(path, object=FakeDir.new) parts = path_parts(normalize_path(path)) @@ -112,5 +99,20 @@ module FakeFS def current_dir find(normalize_path('.')) end + + private + + def find_recurser(dir, parts) + return [] unless dir.respond_to? :[] + + pattern , *parts = parts + matches = dir.reject {|k,v| /\A#{pattern.gsub('?','.').gsub('*', '.*')}\Z/ !~ k }.values + + if parts.empty? # we're done recursing + matches + else + matches.map{|entry| find_recurser(entry, parts) } + end + end end end