doc/SidekiqUniqueJobs/LockConfig.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Class: SidekiqUniqueJobs::LockConfig
— 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::LockConfig";
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 (L)</a> »
<span class='title'><span class='object_link'><a href="../SidekiqUniqueJobs.html" title="SidekiqUniqueJobs (module)">SidekiqUniqueJobs</a></span></span>
»
<span class="title">LockConfig</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::LockConfig
</h1>
<div class="box_info">
<dl>
<dt>Inherits:</dt>
<dd>
<span class="inheritName">Object</span>
<ul class="fullTree">
<li>Object</li>
<li class="next">SidekiqUniqueJobs::LockConfig</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
</dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>lib/sidekiq_unique_jobs/lock_config.rb</dd>
</dl>
</div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>Gathers all configuration for a lock
which helps reduce the amount of instance variables</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>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#errors-instance_method" title="#errors (instance method)">#<strong>errors</strong> ⇒ Object </a>
</span>
<span class="note title readonly">readonly</span>
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute errors.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#limit-instance_method" title="#limit (instance method)">#<strong>limit</strong> ⇒ Object </a>
</span>
<span class="note title readonly">readonly</span>
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute limit.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#lock_info-instance_method" title="#lock_info (instance method)">#<strong>lock_info</strong> ⇒ Object </a>
</span>
<span class="note title readonly">readonly</span>
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute lock_info.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#on_conflict-instance_method" title="#on_conflict (instance method)">#<strong>on_conflict</strong> ⇒ Object </a>
</span>
<span class="note title readonly">readonly</span>
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute on_conflict.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#pttl-instance_method" title="#pttl (instance method)">#<strong>pttl</strong> ⇒ Object </a>
</span>
<span class="note title readonly">readonly</span>
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute pttl.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#timeout-instance_method" title="#timeout (instance method)">#<strong>timeout</strong> ⇒ Object </a>
</span>
<span class="note title readonly">readonly</span>
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute timeout.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#ttl-instance_method" title="#ttl (instance method)">#<strong>ttl</strong> ⇒ Integer<sup>?</sup> </a>
</span>
<span class="note title readonly">readonly</span>
<span class="summary_desc"><div class='inline'><p>The time (in milliseconds) to live after successful.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#type-instance_method" title="#type (instance method)">#<strong>type</strong> ⇒ Object </a>
</span>
<span class="note title readonly">readonly</span>
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute type.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#worker-instance_method" title="#worker (instance method)">#<strong>worker</strong> ⇒ Object </a>
</span>
<span class="note title readonly">readonly</span>
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute worker.</p>
</div></span>
</li>
</ul>
<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="#from_worker-class_method" title="from_worker (class method)">.<strong>from_worker</strong>(options) ⇒ LockConfig </a>
</span>
<span class="summary_desc"><div class='inline'><p>Instantiate a new lock_config based on sidekiq options in worker.</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="#errors_as_string-instance_method" title="#errors_as_string (instance method)">#<strong>errors_as_string</strong> ⇒ String </a>
</span>
<span class="summary_desc"><div class='inline'><p>Return a nice descriptive message with all validation errors.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(job_hash = {}) ⇒ LockConfig </a>
</span>
<span class="note title constructor">constructor</span>
<span class="summary_desc"><div class='inline'><p>A new instance of LockConfig.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#lock_info%3F-instance_method" title="#lock_info? (instance method)">#<strong>lock_info?</strong> ⇒ Boolean </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#on_client_conflict-instance_method" title="#on_client_conflict (instance method)">#<strong>on_client_conflict</strong> ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'><p>the strategy to use as conflict resolution from sidekiq client.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#on_server_conflict-instance_method" title="#on_server_conflict (instance method)">#<strong>on_server_conflict</strong> ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'><p>the strategy to use as conflict resolution from sidekiq server.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#valid%3F-instance_method" title="#valid? (instance method)">#<strong>valid?</strong> ⇒ true, false </a>
</span>
<span class="summary_desc"><div class='inline'><p>Is the configuration valid?.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#wait_for_lock%3F-instance_method" title="#wait_for_lock? (instance method)">#<strong>wait_for_lock?</strong> ⇒ true, false </a>
</span>
<span class="summary_desc"><div class='inline'><p>Indicate if timeout was set.</p>
</div></span>
</li>
</ul>
<div id="constructor_details" class="method_details_list">
<h2>Constructor Details</h2>
<div class="method_details first">
<h3 class="signature first" id="initialize-instance_method">
#<strong>initialize</strong>(job_hash = {}) ⇒ <tt><span class='object_link'><a href="" title="SidekiqUniqueJobs::LockConfig (class)">LockConfig</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns a new instance of LockConfig.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
59
60
61
62
63
64
65
66
67
68
69
70
71
72</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock_config.rb', line 59</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_job_hash'>job_hash</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
<span class='ivar'>@type</span> <span class='op'>=</span> <span class='id identifier rubyid_job_hash'>job_hash</span><span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="../SidekiqUniqueJobs.html#LOCK-constant" title="SidekiqUniqueJobs::LOCK (constant)">LOCK</a></span></span><span class='rbracket'>]</span><span class='op'>&.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
<span class='ivar'>@worker</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../SidekiqUniqueJobs.html" title="SidekiqUniqueJobs (module)">SidekiqUniqueJobs</a></span></span><span class='period'>.</span><span class='id identifier rubyid_safe_constantize'><span class='object_link'><a href="../SidekiqUniqueJobs.html#safe_constantize-class_method" title="SidekiqUniqueJobs.safe_constantize (method)">safe_constantize</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_job_hash'>job_hash</span><span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="../SidekiqUniqueJobs.html#CLASS-constant" title="SidekiqUniqueJobs::CLASS (constant)">CLASS</a></span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
<span class='ivar'>@limit</span> <span class='op'>=</span> <span class='id identifier rubyid_job_hash'>job_hash</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../SidekiqUniqueJobs.html#LOCK_LIMIT-constant" title="SidekiqUniqueJobs::LOCK_LIMIT (constant)">LOCK_LIMIT</a></span></span><span class='comma'>,</span> <span class='int'>1</span><span class='rparen'>)</span><span class='op'>&.</span><span class='id identifier rubyid_to_i'>to_i</span>
<span class='ivar'>@timeout</span> <span class='op'>=</span> <span class='id identifier rubyid_job_hash'>job_hash</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../SidekiqUniqueJobs.html#LOCK_TIMEOUT-constant" title="SidekiqUniqueJobs::LOCK_TIMEOUT (constant)">LOCK_TIMEOUT</a></span></span><span class='comma'>,</span> <span class='int'>0</span><span class='rparen'>)</span><span class='op'>&.</span><span class='id identifier rubyid_to_i'>to_i</span>
<span class='ivar'>@ttl</span> <span class='op'>=</span> <span class='id identifier rubyid_job_hash'>job_hash</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../SidekiqUniqueJobs.html#LOCK_TTL-constant" title="SidekiqUniqueJobs::LOCK_TTL (constant)">LOCK_TTL</a></span></span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_job_hash'>job_hash</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../SidekiqUniqueJobs.html#LOCK_EXPIRATION-constant" title="SidekiqUniqueJobs::LOCK_EXPIRATION (constant)">LOCK_EXPIRATION</a></span></span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
<span class='ivar'>@pttl</span> <span class='op'>=</span> <span class='id identifier rubyid_ttl'>ttl</span> <span class='op'>*</span> <span class='int'>1_000</span>
<span class='ivar'>@lock_info</span> <span class='op'>=</span> <span class='id identifier rubyid_job_hash'>job_hash</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../SidekiqUniqueJobs.html#LOCK_INFO-constant" title="SidekiqUniqueJobs::LOCK_INFO (constant)">LOCK_INFO</a></span></span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='const'><span class='object_link'><a href="../SidekiqUniqueJobs.html" title="SidekiqUniqueJobs (module)">SidekiqUniqueJobs</a></span></span><span class='period'>.</span><span class='id identifier rubyid_config'><span class='object_link'><a href="../SidekiqUniqueJobs.html#config-class_method" title="SidekiqUniqueJobs.config (method)">config</a></span></span><span class='period'>.</span><span class='id identifier rubyid_lock_info'>lock_info</span> <span class='rbrace'>}</span>
<span class='ivar'>@on_conflict</span> <span class='op'>=</span> <span class='id identifier rubyid_job_hash'>job_hash</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../SidekiqUniqueJobs.html#ON_CONFLICT-constant" title="SidekiqUniqueJobs::ON_CONFLICT (constant)">ON_CONFLICT</a></span></span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span>
<span class='ivar'>@errors</span> <span class='op'>=</span> <span class='id identifier rubyid_job_hash'>job_hash</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../SidekiqUniqueJobs.html#ERRORS-constant" title="SidekiqUniqueJobs::ERRORS (constant)">ERRORS</a></span></span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='rbrace'>}</span>
<span class='ivar'>@on_client_conflict</span> <span class='op'>=</span> <span class='id identifier rubyid_job_hash'>job_hash</span><span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="../SidekiqUniqueJobs.html#ON_CLIENT_CONFLICT-constant" title="SidekiqUniqueJobs::ON_CLIENT_CONFLICT (constant)">ON_CLIENT_CONFLICT</a></span></span><span class='rbracket'>]</span>
<span class='ivar'>@on_server_conflict</span> <span class='op'>=</span> <span class='id identifier rubyid_job_hash'>job_hash</span><span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="../SidekiqUniqueJobs.html#ON_SERVER_CONFLICT-constant" title="SidekiqUniqueJobs::ON_SERVER_CONFLICT (constant)">ON_SERVER_CONFLICT</a></span></span><span class='rbracket'>]</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="instance_attr_details" class="attr_details">
<h2>Instance Attribute Details</h2>
<span id=""></span>
<div class="method_details first">
<h3 class="signature first" id="errors-instance_method">
#<strong>errors</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute errors.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
46
47
48</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock_config.rb', line 46</span>
<span class='kw'>def</span> <span class='id identifier rubyid_errors'>errors</span>
<span class='ivar'>@errors</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id=""></span>
<div class="method_details ">
<h3 class="signature " id="limit-instance_method">
#<strong>limit</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute limit.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
22
23
24</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock_config.rb', line 22</span>
<span class='kw'>def</span> <span class='id identifier rubyid_limit'>limit</span>
<span class='ivar'>@limit</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id=""></span>
<div class="method_details ">
<h3 class="signature " id="lock_info-instance_method">
#<strong>lock_info</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute lock_info.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
38
39
40</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock_config.rb', line 38</span>
<span class='kw'>def</span> <span class='id identifier rubyid_lock_info'>lock_info</span>
<span class='ivar'>@lock_info</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id=""></span>
<div class="method_details ">
<h3 class="signature " id="on_conflict-instance_method">
#<strong>on_conflict</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute on_conflict.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
42
43
44</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock_config.rb', line 42</span>
<span class='kw'>def</span> <span class='id identifier rubyid_on_conflict'>on_conflict</span>
<span class='ivar'>@on_conflict</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id=""></span>
<div class="method_details ">
<h3 class="signature " id="pttl-instance_method">
#<strong>pttl</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute pttl.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
34
35
36</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock_config.rb', line 34</span>
<span class='kw'>def</span> <span class='id identifier rubyid_pttl'>pttl</span>
<span class='ivar'>@pttl</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id=""></span>
<div class="method_details ">
<h3 class="signature " id="timeout-instance_method">
#<strong>timeout</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute timeout.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
26
27
28</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock_config.rb', line 26</span>
<span class='kw'>def</span> <span class='id identifier rubyid_timeout'>timeout</span>
<span class='ivar'>@timeout</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id=""></span>
<div class="method_details ">
<h3 class="signature " id="ttl-instance_method">
#<strong>ttl</strong> ⇒ <tt>Integer</tt><sup>?</sup> <span class="extras">(readonly)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the time (in milliseconds) to live after successful.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Integer</tt>, <tt>nil</tt>)</span>
—
<div class='inline'><p>the time (in milliseconds) to live after successful</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
30
31
32</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock_config.rb', line 30</span>
<span class='kw'>def</span> <span class='id identifier rubyid_ttl'>ttl</span>
<span class='ivar'>@ttl</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id=""></span>
<div class="method_details ">
<h3 class="signature " id="type-instance_method">
#<strong>type</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute type.</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/lock_config.rb', line 14</span>
<span class='kw'>def</span> <span class='id identifier rubyid_type'>type</span>
<span class='ivar'>@type</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id=""></span>
<div class="method_details ">
<h3 class="signature " id="worker-instance_method">
#<strong>worker</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute worker.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
18
19
20</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock_config.rb', line 18</span>
<span class='kw'>def</span> <span class='id identifier rubyid_worker'>worker</span>
<span class='ivar'>@worker</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="class_method_details" class="method_details_list">
<h2>Class Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="from_worker-class_method">
.<strong>from_worker</strong>(options) ⇒ <tt><span class='object_link'><a href="" title="SidekiqUniqueJobs::LockConfig (class)">LockConfig</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Instantiate a new lock_config based on sidekiq options in worker</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>options</span>
<span class='type'>(<tt><span class='object_link'><a href="../Hash.html" title="Hash (class)">Hash</a></span></tt>)</span>
—
<div class='inline'><p>sidekiq_options for worker</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="" title="SidekiqUniqueJobs::LockConfig (class)">LockConfig</a></span></tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
55
56
57</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock_config.rb', line 55</span>
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_from_worker'>from_worker</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
<span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_deep_stringify_keys'>deep_stringify_keys</span><span class='rparen'>)</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="errors_as_string-instance_method">
#<strong>errors_as_string</strong> ⇒ <tt>String</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Return a nice descriptive message with all validation errors</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>String</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
104
105
106
107
108
109
110
111
112</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock_config.rb', line 104</span>
<span class='kw'>def</span> <span class='id identifier rubyid_errors_as_string'>errors_as_string</span>
<span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_valid?'>valid?</span>
<span class='ivar'>@errors_as_string</span> <span class='op'>||=</span> <span class='kw'>begin</span>
<span class='id identifier rubyid_error_msg'>error_msg</span> <span class='op'>=</span> <span class='op'>+</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\t</span><span class='tstring_end'>"</span></span>
<span class='id identifier rubyid_error_msg'>error_msg</span> <span class='op'><<</span> <span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_val'>val</span><span class='op'>|</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_content'>: :</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_val'>val</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n\t</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_error_msg'>error_msg</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="lock_info?-instance_method">
#<strong>lock_info?</strong> ⇒ <tt>Boolean</tt>
</h3><div class="docstring">
<div class="discussion">
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Boolean</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
74
75
76</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock_config.rb', line 74</span>
<span class='kw'>def</span> <span class='id identifier rubyid_lock_info?'>lock_info?</span>
<span class='id identifier rubyid_lock_info'>lock_info</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="on_client_conflict-instance_method">
#<strong>on_client_conflict</strong> ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>the strategy to use as conflict resolution from sidekiq client</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
115
116
117
118</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock_config.rb', line 115</span>
<span class='kw'>def</span> <span class='id identifier rubyid_on_client_conflict'>on_client_conflict</span>
<span class='ivar'>@on_client_conflict</span> <span class='op'>||=</span> <span class='id identifier rubyid_on_conflict'>on_conflict</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>client</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_on_conflict'>on_conflict</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../Hash.html" title="Hash (class)">Hash</a></span></span><span class='rparen'>)</span>
<span class='ivar'>@on_client_conflict</span> <span class='op'>||=</span> <span class='id identifier rubyid_on_conflict'>on_conflict</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="on_server_conflict-instance_method">
#<strong>on_server_conflict</strong> ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>the strategy to use as conflict resolution from sidekiq server</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
121
122
123
124</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock_config.rb', line 121</span>
<span class='kw'>def</span> <span class='id identifier rubyid_on_server_conflict'>on_server_conflict</span>
<span class='ivar'>@on_server_conflict</span> <span class='op'>||=</span> <span class='id identifier rubyid_on_conflict'>on_conflict</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>server</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_on_conflict'>on_conflict</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../Hash.html" title="Hash (class)">Hash</a></span></span><span class='rparen'>)</span>
<span class='ivar'>@on_server_conflict</span> <span class='op'>||=</span> <span class='id identifier rubyid_on_conflict'>on_conflict</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="valid?-instance_method">
#<strong>valid?</strong> ⇒ <tt>true</tt>, <tt>false</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Is the configuration valid?</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>true</tt>, <tt>false</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
94
95
96</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock_config.rb', line 94</span>
<span class='kw'>def</span> <span class='id identifier rubyid_valid?'>valid?</span>
<span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="wait_for_lock?-instance_method">
#<strong>wait_for_lock?</strong> ⇒ <tt>true</tt>, <tt>false</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Indicate if timeout was set</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>true</tt>, <tt>false</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
84
85
86</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock_config.rb', line 84</span>
<span class='kw'>def</span> <span class='id identifier rubyid_wait_for_lock?'>wait_for_lock?</span>
<span class='id identifier rubyid_timeout'>timeout</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_timeout'>timeout</span><span class='period'>.</span><span class='id identifier rubyid_positive?'>positive?</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Mon Sep 27 15:29:07 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>