Class: Ghaki::Logger::Null
- Extended by:
- Bool::Accessors
- Includes:
- Bool::Options
- Defined in:
- lib/ghaki/logger/null.rb
Overview
Helper for writing logs to nowhere during testing.
Instance Attribute Summary
Attributes inherited from Base
Attributes included from Liner
Attributes included from CoreExt::Logger
Instance Method Summary collapse
-
#filename ⇒ Object
(also: #file_name)
Return captured filename.
-
#initialize(_opts = {}) ⇒ Null
constructor
Constructor options:.
-
#re_stderr ⇒ Object
Reassign STDERR but only if redirection is allowed.
-
#re_stdout ⇒ Object
Reassign STDOUT but only if redirection is allowed.
-
#re_stds ⇒ Object
Reassign STDOUT and STDERR but only if redirection is allowed.
Methods inherited from Base
Methods included from Liner
#box, #fatal_dump, #liner, #puts
Methods included from CoreExt::Logger
Constructor Details
#initialize(_opts = {}) ⇒ Null
Constructor options:
allow_redirection
-
Allow redirection of STDOUT and STDERR. [default:false]
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ghaki/logger/null.rb', line 25 def initialize _opts={} opts = _opts.dup bool_option opts, false, :allow_redirection opts.delete(:allow_redirection) opts.delete(:log_device) opts.delete(:file_handle) opts[:file_handle] = StringIO.new @keep_fname = opts.delete(:file_name) super( opts ) end |
Instance Method Details
#filename ⇒ Object Also known as: file_name
Return captured filename.
37 38 39 |
# File 'lib/ghaki/logger/null.rb', line 37 def filename @keep_fname end |
#re_stderr ⇒ Object
Reassign STDERR but only if redirection is allowed.
48 49 50 |
# File 'lib/ghaki/logger/null.rb', line 48 def re_stderr super if allow_redirection? end |
#re_stdout ⇒ Object
Reassign STDOUT but only if redirection is allowed.
53 54 55 |
# File 'lib/ghaki/logger/null.rb', line 53 def re_stdout super if allow_redirection? end |
#re_stds ⇒ Object
Reassign STDOUT and STDERR but only if redirection is allowed.
43 44 45 |
# File 'lib/ghaki/logger/null.rb', line 43 def re_stds super if allow_redirection? end |