Module: Kernel

Defined in:
lib/edango/helpers/kernel.rb,
lib/edango/di/helpers.rb,
lib/edango/context/language.rb

Overview

EDango - torrent ticket extractor.

Copyright (C) 2010  Dmitrii Toksaitov

This file is part of EDango.

EDango is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

EDango is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with EDango. If not, see <http://www.gnu.org/licenses/>.

Instance Method Summary collapse

Instance Method Details

#fake_stderr(io, &block) ⇒ Object



31
32
33
34
35
36
37
38
39
40
# File 'lib/edango/helpers/kernel.rb', line 31

def fake_stderr(io, &block)
  result = io

  $stderr = result
  yield if block_given?

  return result
ensure
  $stderr = STDERR
end

#fake_stdout(io, &block) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/edango/helpers/kernel.rb', line 20

def fake_stdout(io, &block)
  result = io

  $stdout = result
  yield if block_given?

  return result
ensure
  $stdout = STDOUT
end

#require_all(file, *files) ⇒ Object



38
39
40
# File 'lib/edango/di/helpers.rb', line 38

def require_all(file, *files)
  (files << file).each { |item| require(item) }
end

#translate(key) ⇒ Object Also known as: t



97
98
99
# File 'lib/edango/context/language.rb', line 97

def translate(key)
  EDango::LANGUAGE[key] || key.to_s()
end