Class: Vtk::Commands::Socks::On

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

Overview

Turns on 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) ⇒ On

Returns a new instance of On.



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

def initialize(options)
  @options = options
  @port = options['port'] || '2001'

  super()
end

Instance Attribute Details

#inputObject (readonly)

Returns the value of attribute input.



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

def input
  @input
end

#outputObject (readonly)

Returns the value of attribute output.



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

def output
  @output
end

#portObject (readonly)

Returns the value of attribute port.



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

def port
  @port
end

Instance Method Details

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



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

def execute(_input: $stdin, output: $stdout)
  @input = input
  @output = output

  return output.puts '----> Already connected to SOCKS.' if connected?

  connect_to_socks
  ensure_connection
end