doc/SidekiqUniqueJobs/Cli.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Class: SidekiqUniqueJobs::Cli
— Documentation by YARD 0.9.26
</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" />
<link rel="stylesheet" href="../css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "SidekiqUniqueJobs::Cli";
relpath = '../';
</script>
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="../class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="../_index.html">Index (C)</a> »
<span class='title'><span class='object_link'><a href="../SidekiqUniqueJobs.html" title="SidekiqUniqueJobs (module)">SidekiqUniqueJobs</a></span></span>
»
<span class="title">Cli</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1>Class: SidekiqUniqueJobs::Cli
</h1>
<div class="box_info">
<dl>
<dt>Inherits:</dt>
<dd>
<span class="inheritName">Thor</span>
<ul class="fullTree">
<li>Object</li>
<li class="next">Thor</li>
<li class="next">SidekiqUniqueJobs::Cli</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
</dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>lib/sidekiq_unique_jobs/cli.rb</dd>
</dl>
</div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>Command line interface for unique jobs</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Author:</p>
<ul class="author">
<li>
<div class='inline'><p>Mikael Henriksson <a href="mailto:mikael@mhenrixon.com">mikael@mhenrixon.com</a></p>
</div>
</li>
</ul>
</div>
<h2>
Class Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#banner-class_method" title="banner (class method)">.<strong>banner</strong>(command, _namespace = nil, _subcommand = false) ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'><p>:nodoc: rubocop:disable Style/OptionalBooleanParameter.</p>
</div></span>
</li>
</ul>
<h2>
Instance Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#console-instance_method" title="#console (instance method)">#<strong>console</strong> ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'><p>:nodoc:.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#del-instance_method" title="#del (instance method)">#<strong>del</strong>(pattern) ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'><p>:nodoc:.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#list-instance_method" title="#list (instance method)">#<strong>list</strong>(pattern = "*") ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'><p>:nodoc:.</p>
</div></span>
</li>
</ul>
<div id="class_method_details" class="method_details_list">
<h2>Class Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="banner-class_method">
.<strong>banner</strong>(command, _namespace = nil, _subcommand = false) ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>:nodoc:
rubocop:disable Style/OptionalBooleanParameter</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
14
15
16</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/cli.rb', line 14</span>
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_banner'>banner</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='id identifier rubyid__namespace'>_namespace</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid__subcommand'>_subcommand</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span> <span class='comment'># rubocop:disable Style/OptionalBooleanParameter
</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>jobs </span><span class='embexpr_beg'>#{</span><span class='ivar'>@package_name</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_usage'>usage</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='comment'># rubocop:disable ThreadSafety/InstanceVariableInClassMethod
</span><span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="console-instance_method">
#<strong>console</strong> ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>:nodoc:</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
45
46
47
48
49
50
51
52</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/cli.rb', line 45</span>
<span class='kw'>def</span> <span class='id identifier rubyid_console'>console</span>
<span class='id identifier rubyid_say'>say</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Use `list '*', 1000 to display the first 1000 unique digests matching '*'</span><span class='tstring_end'>"</span></span>
<span class='id identifier rubyid_say'>say</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Use `del '*', 1000, true (default) to see how many digests would be deleted for the pattern '*'</span><span class='tstring_end'>"</span></span>
<span class='id identifier rubyid_say'>say</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Use `del '*', 1000, false to delete the first 1000 digests matching '*'</span><span class='tstring_end'>"</span></span>
<span class='comment'># Object.include SidekiqUniqueJobs::Api
</span> <span class='id identifier rubyid_console_class'>console_class</span><span class='period'>.</span><span class='id identifier rubyid_start'>start</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="del-instance_method">
#<strong>del</strong>(pattern) ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>:nodoc:</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
32
33
34
35
36
37
38
39
40
41</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/cli.rb', line 32</span>
<span class='kw'>def</span> <span class='id identifier rubyid_del'>del</span><span class='lparen'>(</span><span class='id identifier rubyid_pattern'>pattern</span><span class='rparen'>)</span>
<span class='id identifier rubyid_max_count'>max_count</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:count</span><span class='rbracket'>]</span>
<span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:dry_run</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_digests'>digests</span><span class='period'>.</span><span class='id identifier rubyid_entries'>entries</span><span class='lparen'>(</span><span class='label'>pattern:</span> <span class='id identifier rubyid_pattern'>pattern</span><span class='comma'>,</span> <span class='label'>count:</span> <span class='id identifier rubyid_max_count'>max_count</span><span class='rparen'>)</span>
<span class='id identifier rubyid_say'>say</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Would delete </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span><span class='embexpr_end'>}</span><span class='tstring_content'> digests matching '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pattern'>pattern</span><span class='embexpr_end'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span>
<span class='kw'>else</span>
<span class='id identifier rubyid_deleted_count'>deleted_count</span> <span class='op'>=</span> <span class='id identifier rubyid_digests'>digests</span><span class='period'>.</span><span class='id identifier rubyid_delete_by_pattern'>delete_by_pattern</span><span class='lparen'>(</span><span class='id identifier rubyid_pattern'>pattern</span><span class='comma'>,</span> <span class='label'>count:</span> <span class='id identifier rubyid_max_count'>max_count</span><span class='rparen'>)</span>
<span class='id identifier rubyid_say'>say</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Deleted </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_deleted_count'>deleted_count</span><span class='embexpr_end'>}</span><span class='tstring_content'> digests matching '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pattern'>pattern</span><span class='embexpr_end'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="list-instance_method">
#<strong>list</strong>(pattern = "*") ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>:nodoc:</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
22
23
24
25
26</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/cli.rb', line 22</span>
<span class='kw'>def</span> <span class='id identifier rubyid_list'>list</span><span class='lparen'>(</span><span class='id identifier rubyid_pattern'>pattern</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>*</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_entries'>entries</span> <span class='op'>=</span> <span class='id identifier rubyid_digests'>digests</span><span class='period'>.</span><span class='id identifier rubyid_entries'>entries</span><span class='lparen'>(</span><span class='label'>pattern:</span> <span class='id identifier rubyid_pattern'>pattern</span><span class='comma'>,</span> <span class='label'>count:</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:count</span><span class='rbracket'>]</span><span class='rparen'>)</span>
<span class='id identifier rubyid_say'>say</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Found </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_entries'>entries</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span><span class='embexpr_end'>}</span><span class='tstring_content'> digests matching '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pattern'>pattern</span><span class='embexpr_end'>}</span><span class='tstring_content'>':</span><span class='tstring_end'>"</span></span>
<span class='id identifier rubyid_print_in_columns'>print_in_columns</span><span class='lparen'>(</span><span class='id identifier rubyid_entries'>entries</span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_entries'>entries</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Mon Sep 27 15:29:06 2021 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-3.0.2).
</div>
</div>
</body>
</html>