Class: Auger::Telnet

Inherits:
Connection show all
Defined in:
lib/plugins/telnet.rb

Instance Attribute Summary

Attributes inherited from Connection

#connection, #options, #requests, #response, #roles

Instance Method Summary collapse

Methods inherited from Connection

#do_open, #initialize, load, #method_missing

Constructor Details

This class inherits a constructor from Auger::Connection

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Auger::Connection

Instance Method Details

#close(telnet) ⇒ Object



22
23
24
# File 'lib/plugins/telnet.rb', line 22

def close(telnet)
  telnet.close
end

#cmd(arg, &block) ⇒ Object



26
27
28
# File 'lib/plugins/telnet.rb', line 26

def cmd(arg, &block)
  @requests << TelnetRequest.load(arg, &block)
end

#open(host, options) ⇒ Object



15
16
17
18
19
20
# File 'lib/plugins/telnet.rb', line 15

def open(host, options)
  ## telnet opts array needs capitalized strings as keys
  opts = { 'Host' => host }
  options.each { |key, value| opts[key.to_s.capitalize] = value }
  Net::Telnet::new(opts)
end

#timeout(value) ⇒ Object



11
12
13
# File 'lib/plugins/telnet.rb', line 11

def timeout(value)
  @options[:timeout] = value.to_i
end