Top Level Namespace

Defined Under Namespace

Modules: TFW

Instance Method Summary collapse

Instance Method Details

#silent_blockObject



127
128
129
130
131
132
133
134
135
# File 'lib/tfw.rb', line 127

def silent_block
  stderr, stdout = [STDERR, STDOUT].map(&:clone)
  [STDERR, STDOUT].each { |e| e.reopen File.new('/dev/null', 'w') }
  begin
    yield
  ensure
    { STDERR => stderr, STDOUT => stdout }.each { |k, v| k.reopen v }
  end
end

#tfw_load_module(&block) ⇒ Object



137
138
139
# File 'lib/tfw.rb', line 137

def tfw_load_module(&block)
  TFW.load_module(self, &block)
end