Skip to content

Commit 770d202

Browse files
committed
♻️ Rafactor for improved thread-safety (iii)
- extensions are per-class
1 parent 57c89f2 commit 770d202

23 files changed

+300
-59
lines changed

doc/SnakyHash.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ <h2>Overview</h2><div class="docstring">
123123
</div>
124124

125125
<div id="footer">
126-
Generated on Wed May 21 21:10:55 2025 by
126+
Generated on Wed May 21 21:33:37 2025 by
127127
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
128128
0.9.37 (ruby-3.4.3).
129129
</div>

doc/SnakyHash/Error.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
</div>
115115

116116
<div id="footer">
117-
Generated on Wed May 21 21:10:55 2025 by
117+
Generated on Wed May 21 21:33:37 2025 by
118118
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
119119
0.9.37 (ruby-3.4.3).
120120
</div>

doc/SnakyHash/Extensions.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ <h3 class="signature " id="run-instance_method">
446446
</div>
447447

448448
<div id="footer">
449-
Generated on Wed May 21 21:10:55 2025 by
449+
Generated on Wed May 21 21:33:37 2025 by
450450
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
451451
0.9.37 (ruby-3.4.3).
452452
</div>

doc/SnakyHash/Serializer.html

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ <h2>Defined Under Namespace</h2>
8787
<p class="children">
8888

8989

90-
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Serializer/Modulizer.html" title="SnakyHash::Serializer::Modulizer (module)">Modulizer</a></span>
90+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Serializer/BackportedInstanceMethods.html" title="SnakyHash::Serializer::BackportedInstanceMethods (module)">BackportedInstanceMethods</a></span>, <span class='object_link'><a href="Serializer/Modulizer.html" title="SnakyHash::Serializer::Modulizer (module)">Modulizer</a></span>
9191

9292

9393

@@ -213,15 +213,27 @@ <h3 class="signature first" id="extended-class_method">
213213
9
214214
10
215215
11
216-
12</pre>
216+
12
217+
13
218+
14
219+
15
220+
16
221+
17
222+
18</pre>
217223
</td>
218224
<td>
219225
<pre class="code"><span class="info file"># File 'lib/snaky_hash/serializer.rb', line 9</span>
220226

221227
<span class='kw'>def</span> <span class='id identifier rubyid_extended'>extended</span><span class='lparen'>(</span><span class='id identifier rubyid_base'>base</span><span class='rparen'>)</span>
222228
<span class='id identifier rubyid_extended_module'>extended_module</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Serializer/Modulizer.html" title="SnakyHash::Serializer::Modulizer (module)">Modulizer</a></span></span><span class='period'>.</span><span class='id identifier rubyid_to_extended_mod'><span class='object_link'><a href="Serializer/Modulizer.html#to_extended_mod-class_method" title="SnakyHash::Serializer::Modulizer.to_extended_mod (method)">to_extended_mod</a></span></span>
223229
<span class='id identifier rubyid_base'>base</span><span class='period'>.</span><span class='id identifier rubyid_extend'>extend</span><span class='lparen'>(</span><span class='id identifier rubyid_extended_module'>extended_module</span><span class='rparen'>)</span>
224-
<span class='kw'>end</span></pre>
230+
<span class='comment'># :nocov:
231+
</span> <span class='comment'># This will be run in CI on Ruby 2.3, but we only collect coverage from current Ruby
232+
</span> <span class='kw'>unless</span> <span class='const'>VersionGem</span><span class='op'>::</span><span class='const'>Ruby</span><span class='period'>.</span><span class='id identifier rubyid_gte_minimum_version?'>gte_minimum_version?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>2.4</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
233+
<span class='id identifier rubyid_base'>base</span><span class='period'>.</span><span class='id identifier rubyid_include'>include</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Serializer/BackportedInstanceMethods.html" title="SnakyHash::Serializer::BackportedInstanceMethods (module)">BackportedInstanceMethods</a></span></span><span class='rparen'>)</span>
234+
<span class='kw'>end</span>
235+
<span class='comment'># :nocov:
236+
</span><span class='kw'>end</span></pre>
225237
</td>
226238
</tr>
227239
</table>
@@ -248,13 +260,13 @@ <h3 class="signature first" id="dump-instance_method">
248260
<pre class="lines">
249261

250262

251-
15
252-
16
253-
17
254-
18</pre>
263+
21
264+
22
265+
23
266+
24</pre>
255267
</td>
256268
<td>
257-
<pre class="code"><span class="info file"># File 'lib/snaky_hash/serializer.rb', line 15</span>
269+
<pre class="code"><span class="info file"># File 'lib/snaky_hash/serializer.rb', line 21</span>
258270

259271
<span class='kw'>def</span> <span class='id identifier rubyid_dump'>dump</span><span class='lparen'>(</span><span class='id identifier rubyid_obj'>obj</span><span class='rparen'>)</span>
260272
<span class='id identifier rubyid_hash'>hash</span> <span class='op'>=</span> <span class='id identifier rubyid_dump_hash'>dump_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_obj'>obj</span><span class='rparen'>)</span>
@@ -280,14 +292,14 @@ <h3 class="signature " id="load-instance_method">
280292
<pre class="lines">
281293

282294

283-
20
284-
21
285-
22
286-
23
287-
24</pre>
295+
26
296+
27
297+
28
298+
29
299+
30</pre>
288300
</td>
289301
<td>
290-
<pre class="code"><span class="info file"># File 'lib/snaky_hash/serializer.rb', line 20</span>
302+
<pre class="code"><span class="info file"># File 'lib/snaky_hash/serializer.rb', line 26</span>
291303

292304
<span class='kw'>def</span> <span class='id identifier rubyid_load'>load</span><span class='lparen'>(</span><span class='id identifier rubyid_raw_hash'>raw_hash</span><span class='rparen'>)</span>
293305
<span class='id identifier rubyid_hash'>hash</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_presence'>presence</span><span class='lparen'>(</span><span class='id identifier rubyid_raw_hash'>raw_hash</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>{}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
@@ -304,7 +316,7 @@ <h3 class="signature " id="load-instance_method">
304316
</div>
305317

306318
<div id="footer">
307-
Generated on Wed May 21 21:10:55 2025 by
319+
Generated on Wed May 21 21:33:37 2025 by
308320
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
309321
0.9.37 (ruby-3.4.3).
310322
</div>
Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>
7+
Module: SnakyHash::Serializer::BackportedInstanceMethods
8+
9+
&mdash; Documentation by YARD 0.9.37
10+
11+
</title>
12+
13+
<link rel="stylesheet" href="../../css/style.css" type="text/css" />
14+
15+
<link rel="stylesheet" href="../../css/common.css" type="text/css" />
16+
17+
<script type="text/javascript">
18+
pathId = "SnakyHash::Serializer::BackportedInstanceMethods";
19+
relpath = '../../';
20+
</script>
21+
22+
23+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
24+
25+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
26+
27+
28+
</head>
29+
<body>
30+
<div class="nav_wrap">
31+
<iframe id="nav" src="../../class_list.html?1"></iframe>
32+
<div id="resizer"></div>
33+
</div>
34+
35+
<div id="main" tabindex="-1">
36+
<div id="header">
37+
<div id="menu">
38+
39+
<a href="../../_index.html">Index (B)</a> &raquo;
40+
<span class='title'><span class='object_link'><a href="../../SnakyHash.html" title="SnakyHash (module)">SnakyHash</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Serializer.html" title="SnakyHash::Serializer (module)">Serializer</a></span></span>
41+
&raquo;
42+
<span class="title">BackportedInstanceMethods</span>
43+
44+
</div>
45+
46+
<div id="search">
47+
48+
<a class="full_list_link" id="class_list_link"
49+
href="../../class_list.html">
50+
51+
<svg width="24" height="24">
52+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55+
</svg>
56+
</a>
57+
58+
</div>
59+
<div class="clear"></div>
60+
</div>
61+
62+
<div id="content"><h1>Module: SnakyHash::Serializer::BackportedInstanceMethods
63+
64+
65+
66+
</h1>
67+
<div class="box_info">
68+
69+
70+
71+
72+
73+
74+
75+
76+
77+
78+
79+
<dl>
80+
<dt>Defined in:</dt>
81+
<dd>lib/snaky_hash/serializer.rb</dd>
82+
</dl>
83+
84+
</div>
85+
86+
87+
88+
89+
90+
91+
92+
93+
94+
<h2>
95+
Instance Method Summary
96+
<small><a href="#" class="summary_toggle">collapse</a></small>
97+
</h2>
98+
99+
<ul class="summary">
100+
101+
<li class="public ">
102+
<span class="summary_signature">
103+
104+
<a href="#transform_values-instance_method" title="#transform_values (instance method)">#<strong>transform_values</strong>(&amp;block) &#x21d2; Object </a>
105+
106+
107+
108+
</span>
109+
110+
111+
112+
113+
114+
115+
116+
117+
118+
<span class="summary_desc"><div class='inline'><p>:nocov: This will be run in CI on Ruby 2.3, but we only collect coverage from current Ruby Rails &lt;= 5.2 had a transform_values method, which was added to Ruby in version 2.4.</p>
119+
</div></span>
120+
121+
</li>
122+
123+
124+
</ul>
125+
126+
127+
128+
129+
<div id="instance_method_details" class="method_details_list">
130+
<h2>Instance Method Details</h2>
131+
132+
133+
<div class="method_details first">
134+
<h3 class="signature first" id="transform_values-instance_method">
135+
136+
#<strong>transform_values</strong>(&amp;block) &#x21d2; <tt>Object</tt>
137+
138+
139+
140+
141+
142+
</h3><div class="docstring">
143+
<div class="discussion">
144+
<p>:nocov:<br />
145+
This will be run in CI on Ruby 2.3, but we only collect coverage from current Ruby<br />
146+
Rails &lt;= 5.2 had a transform_values method, which was added to Ruby in version 2.4.<br />
147+
This method is a backport of that original Rails method for Ruby 2.2 and 2.3.</p>
148+
149+
150+
</div>
151+
</div>
152+
<div class="tags">
153+
154+
155+
</div><table class="source_code">
156+
<tr>
157+
<td>
158+
<pre class="lines">
159+
160+
161+
57
162+
58
163+
59
164+
60
165+
61
166+
62
167+
63
168+
64
169+
65</pre>
170+
</td>
171+
<td>
172+
<pre class="code"><span class="info file"># File 'lib/snaky_hash/serializer.rb', line 57</span>
173+
174+
<span class='kw'>def</span> <span class='id identifier rubyid_transform_values'>transform_values</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
175+
<span class='kw'>return</span> <span class='id identifier rubyid_enum_for'>enum_for</span><span class='lparen'>(</span><span class='symbol'>:transform_values</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_size'>size</span> <span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
176+
<span class='kw'>return</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='kw'>if</span> <span class='id identifier rubyid_empty?'>empty?</span>
177+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
178+
<span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
179+
<span class='id identifier rubyid_result'>result</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>yield</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
180+
<span class='kw'>end</span>
181+
<span class='id identifier rubyid_result'>result</span>
182+
<span class='kw'>end</span></pre>
183+
</td>
184+
</tr>
185+
</table>
186+
</div>
187+
188+
</div>
189+
190+
</div>
191+
192+
<div id="footer">
193+
Generated on Wed May 21 21:33:37 2025 by
194+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
195+
0.9.37 (ruby-3.4.3).
196+
</div>
197+
198+
</div>
199+
</body>
200+
</html>

doc/SnakyHash/Serializer/Modulizer.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,6 @@ <h3 class="signature first" id="to_extended_mod-class_method">
145145
<pre class="lines">
146146

147147

148-
28
149-
29
150-
30
151-
31
152-
32
153-
33
154148
34
155149
35
156150
36
@@ -159,10 +153,16 @@ <h3 class="signature first" id="to_extended_mod-class_method">
159153
39
160154
40
161155
41
162-
42</pre>
156+
42
157+
43
158+
44
159+
45
160+
46
161+
47
162+
48</pre>
163163
</td>
164164
<td>
165-
<pre class="code"><span class="info file"># File 'lib/snaky_hash/serializer.rb', line 28</span>
165+
<pre class="code"><span class="info file"># File 'lib/snaky_hash/serializer.rb', line 34</span>
166166

167167
<span class='kw'>def</span> <span class='id identifier rubyid_to_extended_mod'>to_extended_mod</span>
168168
<span class='const'>Module</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
@@ -189,7 +189,7 @@ <h3 class="signature first" id="to_extended_mod-class_method">
189189
</div>
190190

191191
<div id="footer">
192-
Generated on Wed May 21 21:10:55 2025 by
192+
Generated on Wed May 21 21:33:37 2025 by
193193
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
194194
0.9.37 (ruby-3.4.3).
195195
</div>

doc/SnakyHash/Snake.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ <h3 class="signature first" id="included-instance_method">
275275
</div>
276276

277277
<div id="footer">
278-
Generated on Wed May 21 21:10:55 2025 by
278+
Generated on Wed May 21 21:33:37 2025 by
279279
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
280280
0.9.37 (ruby-3.4.3).
281281
</div>

doc/SnakyHash/Snake/SnakyModulizer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ <h3 class="signature first" id="to_mod-class_method">
261261
</div>
262262

263263
<div id="footer">
264-
Generated on Wed May 21 21:10:55 2025 by
264+
Generated on Wed May 21 21:33:37 2025 by
265265
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
266266
0.9.37 (ruby-3.4.3).
267267
</div>

doc/SnakyHash/StringKeyed.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ <h2>Overview</h2><div class="docstring">
130130
</div>
131131

132132
<div id="footer">
133-
Generated on Wed May 21 21:10:55 2025 by
133+
Generated on Wed May 21 21:33:37 2025 by
134134
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
135135
0.9.37 (ruby-3.4.3).
136136
</div>

doc/SnakyHash/SymbolKeyed.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ <h2>Overview</h2><div class="docstring">
130130
</div>
131131

132132
<div id="footer">
133-
Generated on Wed May 21 21:10:55 2025 by
133+
Generated on Wed May 21 21:33:37 2025 by
134134
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
135135
0.9.37 (ruby-3.4.3).
136136
</div>

0 commit comments

Comments
 (0)