Class: Uttk::Dumpers::Dumper
- Inherits:
-
Logger::Backend
- Object
- Logger::Backend
- Uttk::Dumpers::Dumper
- Includes:
- Abstract
- Defined in:
- lib/uttk/dumpers/Dumper.rb
Overview
The dumper is a specific Logger::Backend.
It react to method calls by writting in the output. The output must be acceded like that:
* Using the print method
* Using the puts method
* Using the << method
If you really need to access to the real outputs use each_output.
You can safely call flush in your methods because this method take care of closed and unflushable outputs.
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #<<(arg) ⇒ Object
- #each_output(&block) ⇒ Object
- #flush ⇒ Object
-
#initialize(output = STDOUT, *args) ⇒ Dumper
constructor
A new instance of Dumper.
- #print(*args) ⇒ Object
- #puts(*args) ⇒ Object
Methods inherited from Logger::Backend
Constructor Details
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
28 29 30 |
# File 'lib/uttk/dumpers/Dumper.rb', line 28 def @options end |
Instance Method Details
#<<(arg) ⇒ Object
66 67 68 69 70 71 |
# File 'lib/uttk/dumpers/Dumper.rb', line 66 def << ( arg ) each_output do |o| o << arg end self end |
#each_output(&block) ⇒ Object
47 48 49 |
# File 'lib/uttk/dumpers/Dumper.rb', line 47 def each_output ( &block ) @outputs.each(&block) end |
#flush ⇒ Object
40 41 42 43 44 |
# File 'lib/uttk/dumpers/Dumper.rb', line 40 def flush each_output do |o| o.flush if o.respond_to? :flush and (not o.closed?) end end |
#print(*args) ⇒ Object
59 60 61 62 63 |
# File 'lib/uttk/dumpers/Dumper.rb', line 59 def print ( *args ) each_output do |o| o.print(*args) end end |
#puts(*args) ⇒ Object
52 53 54 55 56 |
# File 'lib/uttk/dumpers/Dumper.rb', line 52 def puts ( *args ) each_output do |o| o.puts(*args) end end |