Class: Expect4r::Iox
- Inherits:
-
BaseLoginObject
- Object
- Base
- BaseLoginObject
- Expect4r::Iox
- Includes:
- Expect4r, Router, Router::CiscoCommon, Router::CiscoCommon::Ping, Router::CiscoCommon::Show, Router::Common, Router::Common::Modes, Router::Iox::Modes
- Defined in:
- lib/router/cisco/iox/iox.rb
Instance Attribute Summary
Attributes inherited from BaseLoginObject
#host, #method, #port, #proxy, #ssh_options, #user
Instance Method Summary collapse
- #commit(arg = {}) ⇒ Object
-
#initialize(*args) ⇒ Iox
constructor
A new instance of Iox.
- #login(arg = {}) ⇒ Object (also: #_login_)
- #putline(line, *args) ⇒ Object
Methods included from Router::CiscoCommon::Ping
Methods included from Router::CiscoCommon::Show
Methods included from Router::Iox::Modes
#config, #config?, #exec, #exec?, #shell, #shell?, #submode?, #to_config, #to_exec, #to_shell
Methods included from Router::CiscoCommon
#config_lvl?, #enable, #method_missing, #top, #top?
Methods included from Router::Common::Modes
#_mode_?, #change_mode_to, #in?
Methods included from Router::Common
Methods included from Expect4r
#_login, #child_exit, #connected?, #exp_print, #exp_puts, #exp_send, #expect, #get_prompt, #getc, #interact, #login_by_proxy, #logout, #putc, #putcr, #read_until, #readline, #spawn
Methods inherited from BaseLoginObject
add, #cmp, #connect_retry, #connect_retry=, #dup, #enable_password, new_ssh, new_telnet, #password, #spawnee, #spawnee_prompt, #spawnee_username
Methods inherited from Base
Constructor Details
#initialize(*args) ⇒ Iox
15 16 17 18 19 |
# File 'lib/router/cisco/iox/iox.rb', line 15 def initialize(*args) super @ps1 = /(.*)(>|#|\$)\s*$/ @more = / --More-- / end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Expect4r::Router::CiscoCommon
Instance Method Details
#commit(arg = {}) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/router/cisco/iox/iox.rb', line 32 def commit(arg={}) return unless config? output = putline "commit", arg if /\% Failed to commit/.match(output.join) err = show_configuration_failed abort_config raise Iox::SemanticError.new(self.class.to_s, show_configuration_failed) end output end |
#login(arg = {}) ⇒ Object Also known as: _login_
21 22 23 24 25 26 |
# File 'lib/router/cisco/iox/iox.rb', line 21 def login(arg={}) super(spawnee, arg) config 'no logging console' if port>0 exec "terminal len 0\nterminal width 0" self end |
#putline(line, *args) ⇒ Object
43 44 45 46 47 |
# File 'lib/router/cisco/iox/iox.rb', line 43 def putline(line,*args) output, rc = super raise SyntaxError.new(self.class.to_s, line) if output.join =~ /\% Invalid input detected at/ output end |