Class: ITRP::Cmd_setlabel

Inherits:
Cmd
  • Object
show all
Defined in:
lib/handlers/setlabel.rb

Instance Attribute Summary

Attributes inherited from Cmd

#attach_cmd, #children, #enabled_in_state, #trigger

Instance Method Summary collapse

Methods inherited from Cmd

#appstate, #find_node, #is_root?, #place_node, #print_state, #set_time_window, #treeprint

Constructor Details

#initialize(e) ⇒ Cmd_setlabel

Returns a new instance of Cmd_setlabel.



5
6
7
8
9
10
# File 'lib/handlers/setlabel.rb', line 5

def initialize (e)
  super(e)
  @enabled_in_state = :counter
  @attach_cmd  = ''
  @trigger = 'setlabel'
end

Instance Method Details

#completions(patt) ⇒ Object



12
13
14
# File 'lib/handlers/setlabel.rb', line 12

def completions(patt)
  %w( key label desc).grep( /^#{Regexp.escape(patt)}/i)
end

#enter(cmdline) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/handlers/setlabel.rb', line 17

def enter(cmdline)

    terms = cmdline.scan( /(\w+)\s*=\s*([\w\-_\.\:,]+)+/ )
    qparams = terms.inject({}) { |acc,t| acc.store( t[0].to_sym, t[1]);acc}

    p qparams 
    req =mk_request(TRP::Message::Command::UPDATE_KEY_REQUEST,
                     :counter_group => appstate(:cgguid),
                     :keys  => [ TRP::KeyT.new( qparams ) ] )


    get_response_zmq(@appenv.zmq_endpt,req) do |resp|
      p resp
    end
end