Class: Arcanus::Output
- Inherits:
-
Object
- Object
- Arcanus::Output
- Defined in:
- lib/arcanus/output.rb
Overview
Encapsulates all communication to an output source.
Class Method Summary collapse
-
.silent ⇒ Arcanus::Output
Creates a Output which displays nothing.
Instance Method Summary collapse
-
#initialize(stream) ⇒ Output
constructor
Creates a new Output instance.
-
#print(output) ⇒ Object
Print the specified output.
-
#tty? ⇒ true, false
Return if output is a TTY console.
Constructor Details
#initialize(stream) ⇒ Output
Creates a new Arcanus::Output instance.
14 15 16 |
# File 'lib/arcanus/output.rb', line 14 def initialize(stream) @output_stream = stream end |
Class Method Details
.silent ⇒ Arcanus::Output
Creates a Arcanus::Output which displays nothing.
7 8 9 |
# File 'lib/arcanus/output.rb', line 7 def self.silent new(File.open('/dev/null', 'w')) end |
Instance Method Details
#print(output) ⇒ Object
Print the specified output.
21 22 23 |
# File 'lib/arcanus/output.rb', line 21 def print(output) @output_stream.print(output) end |
#tty? ⇒ true, false
Return if output is a TTY console.
28 29 30 |
# File 'lib/arcanus/output.rb', line 28 def tty? @output_stream.tty? end |