Skip to content

Commit

Permalink
Merge branch 'patch-1'
Browse files Browse the repository at this point in the history
* patch-1:
  Remove methods before re-defining them
  • Loading branch information
eventualbuddha committed Nov 21, 2014
2 parents 909291b + 077d895 commit e612de8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/fakefs/kernel.rb
Expand Up @@ -9,12 +9,14 @@ class << self

def self.hijack!
captives[:hijacked].each do |name, prc|
::Kernel.send(:remove_method, name.to_sym)
::Kernel.send(:define_method, name.to_sym, &prc)
end
end

def self.unhijack!
captives[:original].each do |name, _prc|
::Kernel.send(:remove_method, name.to_sym)
::Kernel.send(:define_method, name.to_sym, proc do |*args, &block|
::FakeFS::Kernel.captives[:original][name].call(*args, &block)
end)
Expand Down

0 comments on commit e612de8

Please sign in to comment.