From 9fb29f122d7e7b43214c4418414f7671629a126a Mon Sep 17 00:00:00 2001 From: Matt Freels Date: Mon, 27 Jul 2009 10:45:56 -0700 Subject: [PATCH] FakeFS block form seems a part of base. --- lib/fakefs/base.rb | 10 +++++++++- lib/fakefs/safe.rb | 6 ------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/fakefs/base.rb b/lib/fakefs/base.rb index cba54c9..e5d90fb 100644 --- a/lib/fakefs/base.rb +++ b/lib/fakefs/base.rb @@ -28,4 +28,12 @@ module FakeFS const_set(:FileUtils, RealFileUtils) end end -end \ No newline at end of file +end + +def FakeFS + return ::FakeFS unless block_given? + ::FakeFS.activate! + yield + ::FakeFS.deactivate! +end + diff --git a/lib/fakefs/safe.rb b/lib/fakefs/safe.rb index 61eebab..2413598 100644 --- a/lib/fakefs/safe.rb +++ b/lib/fakefs/safe.rb @@ -9,9 +9,3 @@ require 'fakefs/fileutils' require 'fakefs/file' require 'fakefs/dir' -def FakeFS - return ::FakeFS unless block_given? - ::FakeFS.activate! - yield - ::FakeFS.deactivate! -end