class Tengai::Client

Constants

HOST
PORT
PROMPT

Public Class Methods

new(telnet=Net::Telnet) click to toggle source
# File lib/tengai/client.rb, line 9
def initialize(telnet=Net::Telnet)
  @telnet = telnet
  connect!
end

Public Instance Methods

cmd(*args, &blk) click to toggle source
# File lib/tengai/client.rb, line 30
def cmd(*args, &blk)
  connection.cmd(*args, &blk)
end
connect!() click to toggle source
# File lib/tengai/client.rb, line 14
def connect!
  @connection = @telnet.new(
    'Host'   => HOST,
    'Port'   => PORT,
    'Prompt' => PROMPT)
  @connection.waitfor 'Match' => PROMPT
end
connection() click to toggle source
# File lib/tengai/client.rb, line 26
def connection
  @connection
end
disconnect() click to toggle source
# File lib/tengai/client.rb, line 22
def disconnect
  @connection.close
end