Class: Arcanus::Output

Inherits:
Object
  • Object
show all
Defined in:
lib/arcanus/output.rb

Overview

Encapsulates all communication to an output source.

Class Method Summary collapse

Instance Method Summary collapse

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

.silentArcanus::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 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