Module: Dabcup::Tunnel

Defined in:
lib/dabcup/database.rb

Instance Method Summary collapse

Instance Method Details

#disconnectObject



54
55
56
# File 'lib/dabcup/database.rb', line 54

def disconnect
  @ssh.close if @ssh
end

#sshObject



50
51
52
# File 'lib/dabcup/database.rb', line 50

def ssh
  @ssh ||= Net::SSH.start(tunnel.host, tunnel.user, :password => tunnel.password)
end

#system(command, interpolation = {}) ⇒ Object



45
46
47
48
# File 'lib/dabcup/database.rb', line 45

def system(command, interpolation = {})
  command = command % interpolation
  stdout = ssh.exec!(command)
end