Class: Cisco::Base
- Inherits:
-
Object
- Object
- Cisco::Base
- Defined in:
- lib/cisco/base.rb
Instance Attribute Summary collapse
-
#transport ⇒ Object
readonly
Returns the value of attribute transport.
Instance Method Summary collapse
- #clear_cmd ⇒ Object
- #clear_init ⇒ Object
- #cmd(*args) ⇒ Object
- #enable(*args) ⇒ Object
- #extra_init(*args) ⇒ Object
- #host ⇒ Object
-
#initialize(options) ⇒ Base
constructor
A new instance of Base.
- #password ⇒ Object
- #prompt ⇒ Object
- #run(&block) ⇒ Object
Constructor Details
#initialize(options) ⇒ Base
Returns a new instance of Base.
10 11 12 13 14 15 16 17 |
# File 'lib/cisco/base.rb', line 10 def initialize() @transport = [:transport] || :telnet [:prompt] ||= /[#>]\s?\z/n [:password] ||= "" [:autoinit] ||= true @transport = Cisco.const_get(Cisco.constants.find {|const| const =~ Regexp.new(@transport.to_s, Regexp::IGNORECASE)}).new() extra_init("terminal length 0") end |
Instance Attribute Details
#transport ⇒ Object (readonly)
Returns the value of attribute transport.
8 9 10 |
# File 'lib/cisco/base.rb', line 8 def transport @transport end |
Instance Method Details
#clear_cmd ⇒ Object
31 32 33 |
# File 'lib/cisco/base.rb', line 31 def clear_cmd @transport.clear_cmd end |
#clear_init ⇒ Object
39 40 41 |
# File 'lib/cisco/base.rb', line 39 def clear_init @transport.clear_init end |
#cmd(*args) ⇒ Object
43 44 45 |
# File 'lib/cisco/base.rb', line 43 def cmd(*args) @transport.cmd(*args) end |
#enable(*args) ⇒ Object
51 52 53 |
# File 'lib/cisco/base.rb', line 51 def enable(*args) @transport.enable(*args) end |
#extra_init(*args) ⇒ Object
35 36 37 |
# File 'lib/cisco/base.rb', line 35 def extra_init(*args) @transport.extra_init(*args) end |
#host ⇒ Object
19 20 21 |
# File 'lib/cisco/base.rb', line 19 def host @transport.host end |
#password ⇒ Object
23 24 25 |
# File 'lib/cisco/base.rb', line 23 def password @transport.password end |
#prompt ⇒ Object
27 28 29 |
# File 'lib/cisco/base.rb', line 27 def prompt @transport.prompt end |
#run(&block) ⇒ Object
47 48 49 |
# File 'lib/cisco/base.rb', line 47 def run(&block) @transport.run(&block) end |