Class: Vtk::Commands::Socks::Off

Inherits:
Vtk::Command show all
Defined in:
lib/vtk/commands/socks/off.rb

Overview

Turns off SOCKS connection to VA network

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Vtk::Command

#command, #cursor, #editor, #exec_exist?, #generator, #pager, #platform, #prompt, #screen, #which

Constructor Details

#initialize(options) ⇒ Off

Returns a new instance of Off.



12
13
14
15
16
# File 'lib/vtk/commands/socks/off.rb', line 12

def initialize(options)
  @options = options

  super()
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



10
11
12
# File 'lib/vtk/commands/socks/off.rb', line 10

def options
  @options
end

Instance Method Details

#execute(_input: $stdin, output: $stdout) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/vtk/commands/socks/off.rb', line 18

def execute(_input: $stdin, output: $stdout)
  pids_killed = running_pids.map { |pid| kill_pid pid }

  if pids_killed.any? && pids_killed.all?
    output.puts '----> Disconnected from SOCKS.'
  else
    output.puts '----> No SOCKS connection found.'
  end
end