Class: ITRP::Cmd_options
Instance Attribute Summary
Attributes inherited from Cmd
#attach_cmd, #children, #enabled_in_state, #trigger
Instance Method Summary collapse
- #completions(patt) ⇒ Object
- #enter(cmdline) ⇒ Object
-
#initialize(e) ⇒ Cmd_options
constructor
A new instance of Cmd_options.
Methods inherited from Cmd
#appstate, #find_node, #is_root?, #place_node, #print_state, #set_time_window, #treeprint
Constructor Details
#initialize(e) ⇒ Cmd_options
Returns a new instance of Cmd_options.
4 5 6 7 8 9 |
# File 'lib/handlers/options.rb', line 4 def initialize (e) super(e) @enabled_in_state = :any @attach_cmd = 'set' @trigger = 'options' end |
Instance Method Details
#completions(patt) ⇒ Object
11 12 13 |
# File 'lib/handlers/options.rb', line 11 def completions(patt) [ "maxitems", "cgkey", "resolve_keys" ].grep( /^#{Regexp.escape(patt)}/i) end |
#enter(cmdline) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/handlers/options.rb', line 15 def enter(cmdline) terms = cmdline.scan( /(\w+)\s*=\s*([\w\-_\.\:,]+)+/ ) terms.each do |a| val = case a[0] when 'maxitems'; a[1].to_i when 'resolve_keys'; a[1] == "true" else; a[1] end @appenv.context_data.store( a[0].to_sym, val ) end end |