Class: Gaptool::InteractionHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/gaptool_client/host.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host) ⇒ InteractionHandler

Returns a new instance of InteractionHandler.



9
10
11
# File 'lib/gaptool_client/host.rb', line 9

def initialize(host)
  @host = host
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



8
9
10
# File 'lib/gaptool_client/host.rb', line 8

def host
  @host
end

Instance Method Details

#on_data(_command, stream_name, data, _channel) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/gaptool_client/host.rb', line 13

def on_data(_command, stream_name, data, _channel)
  case stream_name
  when :stdout
    puts "#{Rainbow("#{@host}").yellow}> #{data}"
  when :stderr
    STDERR.puts "#{Rainbow("#{@host}").red}> #{data}"
  end
end