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, options = {}) ⇒ Abstract

Returns a new instance of Abstract.



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

def initialize(output, options={})
  @original_output = output
  @options = options
  @color = SSHKit::Color.new(output)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

#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



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

def <<(obj)
  write(obj)
end

#log_command_data(command, _stream_type, _stream_data) ⇒ Object



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

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

#log_command_exit(command) ⇒ Object



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

def log_command_exit(command)
  write(command)
end

#log_command_start(command) ⇒ Object



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

def log_command_start(command)
  write(command)
end

#write(_obj) ⇒ Object



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

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