Class: ITRP::Cmd_resource
Instance Attribute Summary
Attributes inherited from Cmd
#attach_cmd, #children, #enabled_in_state, #trigger
Instance Method Summary collapse
- #completions(patt) ⇒ Object
- #enter(s) ⇒ Object
-
#initialize(e) ⇒ Cmd_resource
constructor
A new instance of Cmd_resource.
Methods inherited from Cmd
#appstate, #find_node, #is_root?, #place_node, #print_state, #set_time_window, #treeprint
Constructor Details
#initialize(e) ⇒ Cmd_resource
Returns a new instance of Cmd_resource.
4 5 6 7 8 9 |
# File 'lib/handlers/resource.rb', line 4 def initialize (e) super(e) @enabled_in_state = :any @attach_cmd = 'set' @trigger = 'resource' end |
Instance Method Details
#completions(patt) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/handlers/resource.rb', line 12 def completions(patt) [ "HTTP URIs {4EF9DEB9-4332-4867-A667-6A30C5900E9E} ", "DNS Resources {D1E27FF0-6D66-4E57-BB91-99F76BB2143E} ", "SSL Certs {5AEE3F0B-9304-44BE-BBD0-0467052CF468} ", ].grep( /#{Regexp.escape(patt)}/i) end |
#enter(s) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/handlers/resource.rb', line 19 def enter(s) patt = s.scan(/set\s+resource\s+(.*)\s+({.*}$)/).flatten patt[0].strip! print("\nContext set to resource group [#{patt[0]}] [#{patt[1]}]\n\n") @appenv.prompt = "iTRP R:(#{patt[0]})> " @appenv.context_data[:cgguid] = patt[1] @appenv.context_data[:cgname] = patt[0] @appenv.context = :resource end |