Class: RQ::Deleter
- Inherits:
-
MainHelper
- Object
- MainHelper
- RQ::Deleter
- Defined in:
- lib/rq-0.1.7/deleter.rb
Constant Summary
Constants included from Logging
Logging::DIV0, Logging::DIV1, Logging::DIV2, Logging::DIV3, Logging::EOL, Logging::SEC0, Logging::SEC1, Logging::SEC2, Logging::SEC3
Instance Attribute Summary
Attributes inherited from MainHelper
#argv, #cmd, #env, #logger, #main, #mode, #options, #q, #qpath
Instance Method Summary collapse
-
#delete ⇒ Object
{{{.
Methods inherited from MainHelper
Methods included from Logging
Methods included from Logging::LogMethods
#debug, #error, #fatal, #info, #logerr, #logger, #logger=, #warn
Methods included from Util
#alive?, append_features, #btrace, #columnize, #defval, #emsg, #erreq, #errmsg, #escape, #escape!, #exec, export, #fork, #getopt, #hashify, #host, #hostname, #klass, #maim, #mcp, #realpath, #stamptime, #system, #timestamp, #tmpnam, #uncache
Constructor Details
This class inherits a constructor from RQ::MainHelper
Instance Method Details
#delete ⇒ Object
{{{
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rq-0.1.7/deleter.rb', line 11 def delete #{{{ set_q jids = @argv if jids.empty? or not STDIN.tty? pat = %r/^(?:\s*jid\s*:)?\s*(\d+)\s*$/io while((line = STDIN.gets)) match = pat.match line next unless match jids << Integer(match[1]) end end jids.map!{|jid| jid =~ %r/^\s*\d+\s*$/o ? Integer(jid) : jid} raise "no jids" if jids.empty? if @options['quiet'] @q.delete(*jids) else @q.delete(*jids) puts '---' jids.each{|jid| puts "- #{ jid }"} end #}}} end |