Module: Oxidized::Input::CLI
Instance Method Summary collapse
- #connect_cli ⇒ Object
- #disconnect_cli ⇒ Object
- #get ⇒ Object
- #initialize ⇒ Object
- #password(re = /^Password/) ⇒ Object
- #post_login(_post_login = nil, &block) ⇒ Object
- #pre_logout(_pre_logout = nil, &block) ⇒ Object
- #username(re = /^(Username|login)/) ⇒ Object
Instance Method Details
#connect_cli ⇒ Object
18 19 20 |
# File 'lib/oxidized/input/cli.rb', line 18 def connect_cli @post_login.each { |command, block| block ? block.call : (cmd command) } end |
#disconnect_cli ⇒ Object
22 23 24 |
# File 'lib/oxidized/input/cli.rb', line 22 def disconnect_cli @pre_logout.each { |command, block| block ? block.call : (cmd command, nil) } end |
#get ⇒ Object
11 12 13 14 15 16 |
# File 'lib/oxidized/input/cli.rb', line 11 def get connect_cli d = @node.model.get disconnect d end |
#initialize ⇒ Object
5 6 7 8 9 |
# File 'lib/oxidized/input/cli.rb', line 5 def initialize @post_login = [] @pre_logout = [] @username, @password, @exec = nil end |
#password(re = /^Password/) ⇒ Object
42 43 44 |
# File 'lib/oxidized/input/cli.rb', line 42 def password re=/^Password/ @password or @password = re end |
#post_login(_post_login = nil, &block) ⇒ Object
26 27 28 29 30 |
# File 'lib/oxidized/input/cli.rb', line 26 def post_login _post_login=nil, &block unless @exec @post_login << [_post_login, block] end end |
#pre_logout(_pre_logout = nil, &block) ⇒ Object
32 33 34 35 36 |
# File 'lib/oxidized/input/cli.rb', line 32 def pre_logout _pre_logout=nil, &block unless @exec @pre_logout << [_pre_logout, block] end end |
#username(re = /^(Username|login)/) ⇒ Object
38 39 40 |
# File 'lib/oxidized/input/cli.rb', line 38 def username re=/^(Username|login)/ @username or @username = re end |