Class: SSHKit::Formatter::Abstract

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/sshkit/formatters/abstract.rb

Direct Known Subclasses

BlackHole, Dot, Pretty

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ Abstract

Returns a new instance of Abstract.



14
15
16
17
# File 'lib/sshkit/formatters/abstract.rb', line 14

def initialize(output)
  @original_output = output
  @color = SSHKit::Color.new(output)
end

Instance Attribute Details

#original_outputObject (readonly)

Returns the value of attribute original_output.



10
11
12
# File 'lib/sshkit/formatters/abstract.rb', line 10

def original_output
  @original_output
end

Instance Method Details

#<<(obj) ⇒ Object



38
39
40
# File 'lib/sshkit/formatters/abstract.rb', line 38

def <<(obj)
  write(obj)
end

#log_command_data(command, _stream_type, _stream_data) ⇒ Object



30
31
32
# File 'lib/sshkit/formatters/abstract.rb', line 30

def log_command_data(command, _stream_type, _stream_data)
  write(command)
end

#log_command_exit(command) ⇒ Object



34
35
36
# File 'lib/sshkit/formatters/abstract.rb', line 34

def log_command_exit(command)
  write(command)
end

#log_command_start(command) ⇒ Object



26
27
28
# File 'lib/sshkit/formatters/abstract.rb', line 26

def log_command_start(command)
  write(command)
end

#write(_obj) ⇒ Object



42
43
44
# File 'lib/sshkit/formatters/abstract.rb', line 42

def write(_obj)
  raise "Abstract formatter should not be used directly, maybe you want SSHKit::Formatter::BlackHole"
end