Module: FakeFS::Kernel
- Defined in:
- lib/fakefs/kernel.rb
Overview
Kernel Module
Class Attribute Summary collapse
-
.captives ⇒ Object
Returns the value of attribute captives.
Class Method Summary collapse
Class Attribute Details
.captives ⇒ Object
Returns the value of attribute captives.
7 8 9 |
# File 'lib/fakefs/kernel.rb', line 7 def captives @captives end |
Class Method Details
.hijack! ⇒ Object
10 11 12 13 14 15 |
# File 'lib/fakefs/kernel.rb', line 10 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 |
.unhijack! ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/fakefs/kernel.rb', line 17 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) end end |