doc/SidekiqUniqueJobs/LockType.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Class: SidekiqUniqueJobs::LockType
— Documentation by YARD 0.9.34
</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::LockType";
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">LockType</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::LockType
</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::LockType</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
</dd>
</dl>
<dl>
<dt>Includes:</dt>
<dd><span class='object_link'><a href="SidekiqWorkerMethods.html" title="SidekiqUniqueJobs::SidekiqWorkerMethods (module)">SidekiqWorkerMethods</a></span></dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>lib/sidekiq_unique_jobs/lock_type.rb</dd>
</dl>
</div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>Calculates the lock type</p>
</div>
</div>
<div class="tags">
</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="#item-instance_method" title="#item (instance method)">#<strong>item</strong> ⇒ Object </a>
</span>
<span class="note title readonly">readonly</span>
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute item.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#job_class-instance_method" title="#job_class (instance method)">#<strong>job_class</strong> ⇒ Object </a>
</span>
<span class="note title not_defined_here">
included
from <span class='object_link'><a href="SidekiqWorkerMethods.html#job_class-instance_method" title="SidekiqUniqueJobs::SidekiqWorkerMethods#job_class (method)">SidekiqWorkerMethods</a></span>
</span>
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute job_class.</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="#call-class_method" title="call (class method)">.<strong>call</strong>(item) ⇒ Symbol, NilClass </a>
</span>
<span class="summary_desc"><div class='inline'><p>Computes lock type from job arguments, sidekiq_options.</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="#after_unlock_hook-instance_method" title="#after_unlock_hook (instance method)">#<strong>after_unlock_hook</strong> ⇒ Proc </a>
</span>
<span class="note title not_defined_here">
included
from <span class='object_link'><a href="SidekiqWorkerMethods.html#after_unlock_hook-instance_method" title="SidekiqUniqueJobs::SidekiqWorkerMethods#after_unlock_hook (method)">SidekiqWorkerMethods</a></span>
</span>
<span class="summary_desc"><div class='inline'><p>The hook to call after a successful unlock.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#call-instance_method" title="#call (instance method)">#<strong>call</strong> ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#default_job_options-instance_method" title="#default_job_options (instance method)">#<strong>default_job_options</strong> ⇒ Hash<Symbol, Object> </a>
</span>
<span class="note title not_defined_here">
included
from <span class='object_link'><a href="SidekiqWorkerMethods.html#default_job_options-instance_method" title="SidekiqUniqueJobs::SidekiqWorkerMethods#default_job_options (method)">SidekiqWorkerMethods</a></span>
</span>
<span class="summary_desc"><div class='inline'><p>Returns the default worker options from Sidekiq.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(item) ⇒ LockType </a>
</span>
<span class="note title constructor">constructor</span>
<span class="summary_desc"><div class='inline'><p>A new instance of LockType.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#job_class_constantize-instance_method" title="#job_class_constantize (instance method)">#<strong>job_class_constantize</strong>(klazz = @job_class) ⇒ Sidekiq::Worker </a>
</span>
<span class="note title not_defined_here">
included
from <span class='object_link'><a href="SidekiqWorkerMethods.html#job_class_constantize-instance_method" title="SidekiqUniqueJobs::SidekiqWorkerMethods#job_class_constantize (method)">SidekiqWorkerMethods</a></span>
</span>
<span class="summary_desc"><div class='inline'><p>Attempt to constantize a string worker_class argument, always failing back to the original argument when the constant can't be found.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#job_method_defined%3F-instance_method" title="#job_method_defined? (instance method)">#<strong>job_method_defined?</strong>(method_sym) ⇒ true, false </a>
</span>
<span class="note title not_defined_here">
included
from <span class='object_link'><a href="SidekiqWorkerMethods.html#job_method_defined%3F-instance_method" title="SidekiqUniqueJobs::SidekiqWorkerMethods#job_method_defined? (method)">SidekiqWorkerMethods</a></span>
</span>
<span class="summary_desc"><div class='inline'><p>Avoids duplicating worker_class.respond_to? in multiple places.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#job_options-instance_method" title="#job_options (instance method)">#<strong>job_options</strong> ⇒ Hash </a>
</span>
<span class="note title not_defined_here">
included
from <span class='object_link'><a href="SidekiqWorkerMethods.html#job_options-instance_method" title="SidekiqUniqueJobs::SidekiqWorkerMethods#job_options (method)">SidekiqWorkerMethods</a></span>
</span>
<span class="summary_desc"><div class='inline'><p>Wraps #get_sidekiq_options to always work with a hash.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#sidekiq_job_class%3F-instance_method" title="#sidekiq_job_class? (instance method)">#<strong>sidekiq_job_class?</strong> ⇒ true, false </a>
</span>
<span class="note title not_defined_here">
included
from <span class='object_link'><a href="SidekiqWorkerMethods.html#sidekiq_job_class%3F-instance_method" title="SidekiqUniqueJobs::SidekiqWorkerMethods#sidekiq_job_class? (method)">SidekiqWorkerMethods</a></span>
</span>
<span class="summary_desc"><div class='inline'><p>Tests that the.</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>(item) ⇒ <tt><span class='object_link'><a href="" title="SidekiqUniqueJobs::LockType (class)">LockType</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns a new instance of LockType.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>item</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>the Sidekiq job hash</p>
</div>
</li>
</ul>
<p class="tag_title">Options Hash (<tt>item</tt>):</p>
<ul class="option">
<li>
<span class="name">:lock</span>
<span class="type">(<tt>Symbol</tt>, <tt>nil</tt>)</span>
<span class="default">
</span>
— <div class='inline'><p>the type of lock to use.</p>
</div>
</li>
<li>
<span class="name">:class</span>
<span class="type">(<tt>String</tt>)</span>
<span class="default">
</span>
— <div class='inline'><p>the class of the sidekiq worker</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
28
29
30
31</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock_type.rb', line 28</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='rparen'>)</span>
<span class='ivar'>@item</span> <span class='op'>=</span> <span class='id identifier rubyid_item'>item</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_job_class'>job_class</span> <span class='op'>=</span> <span class='id identifier rubyid_item'>item</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='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="item-instance_method">
#<strong>item</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute item.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
23
24
25</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock_type.rb', line 23</span>
<span class='kw'>def</span> <span class='id identifier rubyid_item'>item</span>
<span class='ivar'>@item</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id="job_class=-instance_method"></span>
<div class="method_details ">
<h3 class="signature " id="job_class-instance_method">
#<strong>job_class</strong> ⇒ <tt>Object</tt>
<span class="not_defined_here">
Originally defined in module
<span class='object_link'><a href="SidekiqWorkerMethods.html#job_class-instance_method" title="SidekiqUniqueJobs::SidekiqWorkerMethods#job_class (method)">SidekiqWorkerMethods</a></span>
</span>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute job_class.</p>
</div>
</div>
<div class="tags">
</div>
</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="call-class_method">
.<strong>call</strong>(item) ⇒ <tt>Symbol</tt>, <tt>NilClass</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Computes lock type from job arguments, sidekiq_options.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Symbol</tt>)</span>
—
<div class='inline'><p>the lock type</p>
</div>
</li>
<li>
<span class='type'>(<tt>NilClass</tt>)</span>
—
<div class='inline'><p>if no lock type is found.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
17
18
19</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock_type.rb', line 17</span>
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='rparen'>)</span>
<span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</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="after_unlock_hook-instance_method">
#<strong>after_unlock_hook</strong> ⇒ <tt>Proc</tt>
<span class="not_defined_here">
Originally defined in module
<span class='object_link'><a href="SidekiqWorkerMethods.html#after_unlock_hook-instance_method" title="SidekiqUniqueJobs::SidekiqWorkerMethods#after_unlock_hook (method)">SidekiqWorkerMethods</a></span>
</span>
</h3><div class="docstring">
<div class="discussion">
<p>The hook to call after a successful unlock</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Proc</tt>)</span>
</li>
</ul>
</div>
</div>
<div class="method_details ">
<h3 class="signature " id="call-instance_method">
#<strong>call</strong> ⇒ <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
33
34
35</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/lock_type.rb', line 33</span>
<span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span>
<span class='id identifier rubyid_item'>item</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_job_options'>job_options</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_default_job_options'>default_job_options</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='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="default_job_options-instance_method">
#<strong>default_job_options</strong> ⇒ <tt><span class='object_link'><a href="../Hash.html" title="Hash (class)">Hash</a></span><Symbol, Object></tt>
<span class="not_defined_here">
Originally defined in module
<span class='object_link'><a href="SidekiqWorkerMethods.html#default_job_options-instance_method" title="SidekiqUniqueJobs::SidekiqWorkerMethods#default_job_options (method)">SidekiqWorkerMethods</a></span>
</span>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the default worker options from Sidekiq</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="../Hash.html" title="Hash (class)">Hash</a></span><Symbol, Object></tt>)</span>
</li>
</ul>
</div>
</div>
<div class="method_details ">
<h3 class="signature " id="job_class_constantize-instance_method">
#<strong>job_class_constantize</strong>(klazz = @job_class) ⇒ <tt><span class='object_link'><a href="../Sidekiq/Worker.html" title="Sidekiq::Worker (module)">Sidekiq::Worker</a></span></tt>
<span class="not_defined_here">
Originally defined in module
<span class='object_link'><a href="SidekiqWorkerMethods.html#job_class_constantize-instance_method" title="SidekiqUniqueJobs::SidekiqWorkerMethods#job_class_constantize (method)">SidekiqWorkerMethods</a></span>
</span>
</h3><div class="docstring">
<div class="discussion">
<p>Attempt to constantize a string worker_class argument, always
failing back to the original argument when the constant can't be found</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="../Sidekiq/Worker.html" title="Sidekiq::Worker (module)">Sidekiq::Worker</a></span></tt>)</span>
</li>
</ul>
</div>
</div>
<div class="method_details ">
<h3 class="signature " id="job_method_defined?-instance_method">
#<strong>job_method_defined?</strong>(method_sym) ⇒ <tt>true</tt>, <tt>false</tt>
<span class="not_defined_here">
Originally defined in module
<span class='object_link'><a href="SidekiqWorkerMethods.html#job_method_defined%3F-instance_method" title="SidekiqUniqueJobs::SidekiqWorkerMethods#job_method_defined? (method)">SidekiqWorkerMethods</a></span>
</span>
</h3><div class="docstring">
<div class="discussion">
<p>Avoids duplicating worker_class.respond_to? in multiple places</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>
</div>
<div class="method_details ">
<h3 class="signature " id="job_options-instance_method">
#<strong>job_options</strong> ⇒ <tt><span class='object_link'><a href="../Hash.html" title="Hash (class)">Hash</a></span></tt>
<span class="not_defined_here">
Originally defined in module
<span class='object_link'><a href="SidekiqWorkerMethods.html#job_options-instance_method" title="SidekiqUniqueJobs::SidekiqWorkerMethods#job_options (method)">SidekiqWorkerMethods</a></span>
</span>
</h3><div class="docstring">
<div class="discussion">
<p>Wraps #get_sidekiq_options to always work with a hash</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="../Hash.html" title="Hash (class)">Hash</a></span></tt>)</span>
—
<div class='inline'><p>of the worker class sidekiq options</p>
</div>
</li>
</ul>
</div>
</div>
<div class="method_details ">
<h3 class="signature " id="sidekiq_job_class?-instance_method">
#<strong>sidekiq_job_class?</strong> ⇒ <tt>true</tt>, <tt>false</tt>
<span class="not_defined_here">
Originally defined in module
<span class='object_link'><a href="SidekiqWorkerMethods.html#sidekiq_job_class%3F-instance_method" title="SidekiqUniqueJobs::SidekiqWorkerMethods#sidekiq_job_class? (method)">SidekiqWorkerMethods</a></span>
</span>
</h3><div class="docstring">
<div class="discussion">
<p>Tests that the</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>true</tt>)</span>
—
<div class='inline'><p>if job_class responds to get_sidekiq_options</p>
</div>
</li>
<li>
<span class='type'>(<tt>false</tt>)</span>
—
<div class='inline'><p>if job_class does not respond to get_sidekiq_options</p>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="footer">
Generated on Wed Jan 24 10:57:24 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
</div>
</body>
</html>