inquery 1.0.10 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rubocop.yml +1 -1
  3. data/.github/workflows/ruby.yml +24 -8
  4. data/.gitignore +2 -2
  5. data/.rubocop.yml +4 -0
  6. data/Appraisals +24 -4
  7. data/CHANGELOG.md +47 -1
  8. data/Gemfile +17 -1
  9. data/Gemfile.lock +125 -0
  10. data/LICENSE +1 -1
  11. data/MIGRATION.md +260 -0
  12. data/README.md +31 -9
  13. data/RUBY_VERSION +1 -1
  14. data/Rakefile +4 -11
  15. data/VERSION +1 -1
  16. data/doc/Inquery/Exceptions/Base.html +4 -4
  17. data/doc/Inquery/Exceptions/InvalidRelation.html +4 -4
  18. data/doc/Inquery/Exceptions/UnknownCallSignature.html +4 -4
  19. data/doc/Inquery/Exceptions.html +4 -4
  20. data/doc/Inquery/MethodAccessibleHash.html +431 -0
  21. data/doc/Inquery/Mixins/RawSqlUtils.html +17 -4
  22. data/doc/Inquery/Mixins/RelationValidation/ClassMethods.html +8 -7
  23. data/doc/Inquery/Mixins/RelationValidation.html +9 -8
  24. data/doc/Inquery/Mixins/SchemaValidation/ClassMethods.html +20 -6
  25. data/doc/Inquery/Mixins/SchemaValidation.html +4 -4
  26. data/doc/Inquery/Mixins.html +4 -4
  27. data/doc/Inquery/Query/Chainable.html +207 -90
  28. data/doc/Inquery/Query.html +401 -73
  29. data/doc/Inquery.html +121 -6
  30. data/doc/_index.html +12 -5
  31. data/doc/class_list.html +6 -3
  32. data/doc/css/full_list.css +3 -3
  33. data/doc/css/style.css +6 -0
  34. data/doc/file.README.html +118 -17
  35. data/doc/file_list.html +5 -2
  36. data/doc/frames.html +10 -5
  37. data/doc/index.html +118 -17
  38. data/doc/js/app.js +294 -264
  39. data/doc/js/full_list.js +30 -4
  40. data/doc/method_list.html +52 -17
  41. data/doc/top-level-namespace.html +4 -4
  42. data/gemfiles/rails_5.2.gemfile +1 -0
  43. data/gemfiles/rails_6.0.gemfile +1 -0
  44. data/gemfiles/rails_6.1.gemfile +1 -0
  45. data/gemfiles/rails_7.0.gemfile +1 -0
  46. data/gemfiles/{rails_5.1.gemfile → rails_7.1.gemfile} +2 -1
  47. data/gemfiles/rails_7.2.gemfile +8 -0
  48. data/gemfiles/rails_8.0.gemfile +8 -0
  49. data/gemfiles/rails_8.1.gemfile +8 -0
  50. data/inquery.gemspec +11 -34
  51. data/lib/inquery/method_accessible_hash.rb +45 -0
  52. data/lib/inquery/mixins/raw_sql_utils.rb +32 -6
  53. data/lib/inquery/mixins/relation_validation.rb +1 -1
  54. data/lib/inquery/mixins/schema_validation.rb +8 -1
  55. data/lib/inquery/query/chainable.rb +69 -27
  56. data/lib/inquery/query.rb +67 -14
  57. data/lib/inquery.rb +9 -0
  58. data/test/inquery/error_handling_test.rb +117 -0
  59. data/test/inquery/method_accessible_hash_test.rb +85 -0
  60. data/test/inquery/mixins/raw_sql_utils_test.rb +67 -0
  61. data/test/inquery/query/chainable_test.rb +78 -0
  62. data/test/inquery/query_test.rb +86 -0
  63. data/test/test_helper.rb +11 -0
  64. metadata +30 -129
  65. data/.yardopts +0 -1
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: Inquery::Mixins::RelationValidation
8
8
 
9
- &mdash; Documentation by YARD 0.9.27
9
+ &mdash; Documentation by YARD 0.9.37
10
10
 
11
11
  </title>
12
12
 
@@ -185,7 +185,8 @@
185
185
 
186
186
 
187
187
 
188
- <span class="summary_desc"><div class='inline'><p>Validates (and possibly alters) the given relation according to the options specified at class level using the <code>relation</code> method.</p>
188
+ <span class="summary_desc"><div class='inline'>
189
+ <p>Validates (and possibly alters) the given relation according to the options specified at class level using the ‘relation` method.</p>
189
190
  </div></span>
190
191
 
191
192
  </li>
@@ -212,8 +213,8 @@
212
213
 
213
214
  </h3><div class="docstring">
214
215
  <div class="discussion">
215
- <p>Validates (and possibly alters) the given relation according to the
216
- options specified at class level using the <code>relation</code> method.</p>
216
+
217
+ <p>Validates (and possibly alters) the given relation according to the options specified at class level using the relation` method.</p>
217
218
 
218
219
 
219
220
  </div>
@@ -304,7 +305,7 @@ options specified at class level using the <code>relation</code> method.</p>
304
305
  </span> <span class='comment'># ---------------------------------------------------------------
305
306
  </span> <span class='id identifier rubyid_fields_count'>fields_count</span> <span class='op'>=</span> <span class='id identifier rubyid_relation'>relation</span><span class='period'>.</span><span class='id identifier rubyid_select_values'>select_values</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span>
306
307
 
307
- <span class='kw'>if</span> <span class='id identifier rubyid_fields_count'>fields_count</span><span class='period'>.</span><span class='id identifier rubyid_zero?'>zero?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:default_select</span><span class='rbracket'>]</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:fields</span><span class='rbracket'>]</span> <span class='op'>&amp;&amp;</span> <span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:fields</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_positive?'>positive?</span>
308
+ <span class='kw'>if</span> <span class='id identifier rubyid_fields_count'>fields_count</span><span class='period'>.</span><span class='id identifier rubyid_zero?'>zero?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:default_select</span><span class='rbracket'>]</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:fields</span><span class='rbracket'>]</span><span class='op'>&amp;.</span><span class='id identifier rubyid_positive?'>positive?</span>
308
309
  <span class='id identifier rubyid_relation'>relation</span> <span class='op'>=</span> <span class='id identifier rubyid_relation'>relation</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:default_select</span><span class='rbracket'>]</span><span class='rparen'>)</span>
309
310
  <span class='id identifier rubyid_fields_count'>fields_count</span> <span class='op'>=</span> <span class='int'>1</span>
310
311
  <span class='kw'>end</span>
@@ -325,9 +326,9 @@ options specified at class level using the <code>relation</code> method.</p>
325
326
  </div>
326
327
 
327
328
  <div id="footer">
328
- Generated on Thu May 19 10:36:15 2022 by
329
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
330
- 0.9.27 (ruby-3.0.1).
329
+ Generated on Mon Jan 5 14:06:48 2026 by
330
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
331
+ 0.9.37 (ruby-3.3.5).
331
332
  </div>
332
333
 
333
334
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: Inquery::Mixins::SchemaValidation::ClassMethods
8
8
 
9
- &mdash; Documentation by YARD 0.9.27
9
+ &mdash; Documentation by YARD 0.9.37
10
10
 
11
11
  </title>
12
12
 
@@ -206,13 +206,27 @@
206
206
 
207
207
  25
208
208
  26
209
- 27</pre>
209
+ 27
210
+ 28
211
+ 29
212
+ 30
213
+ 31
214
+ 32
215
+ 33
216
+ 34</pre>
210
217
  </td>
211
218
  <td>
212
219
  <pre class="code"><span class="info file"># File 'lib/inquery/mixins/schema_validation.rb', line 25</span>
213
220
 
214
221
  <span class='kw'>def</span> <span class='id identifier rubyid_schema'>schema</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
215
- <span class='id identifier rubyid_schema2'>schema2</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
222
+ <span class='kw'>case</span> <span class='const'><span class='object_link'><a href="../../../Inquery.html" title="Inquery (module)">Inquery</a></span></span><span class='period'>.</span><span class='id identifier rubyid_default_schema_version'>default_schema_version</span>
223
+ <span class='kw'>when</span> <span class='int'>2</span>
224
+ <span class='id identifier rubyid_schema2'>schema2</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
225
+ <span class='kw'>when</span> <span class='int'>3</span>
226
+ <span class='id identifier rubyid_schema3'>schema3</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
227
+ <span class='kw'>else</span>
228
+ <span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Schemacop schema versions supported are 2 and 3.</span><span class='tstring_end'>&#39;</span></span>
229
+ <span class='kw'>end</span>
216
230
  <span class='kw'>end</span></pre>
217
231
  </td>
218
232
  </tr>
@@ -292,9 +306,9 @@
292
306
  </div>
293
307
 
294
308
  <div id="footer">
295
- Generated on Thu May 19 10:36:15 2022 by
296
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
297
- 0.9.27 (ruby-3.0.1).
309
+ Generated on Mon Jan 5 14:06:48 2026 by
310
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
311
+ 0.9.37 (ruby-3.3.5).
298
312
  </div>
299
313
 
300
314
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: Inquery::Mixins::SchemaValidation
8
8
 
9
- &mdash; Documentation by YARD 0.9.27
9
+ &mdash; Documentation by YARD 0.9.37
10
10
 
11
11
  </title>
12
12
 
@@ -116,9 +116,9 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Thu May 19 10:36:15 2022 by
120
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
121
- 0.9.27 (ruby-3.0.1).
119
+ Generated on Mon Jan 5 14:06:48 2026 by
120
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
121
+ 0.9.37 (ruby-3.3.5).
122
122
  </div>
123
123
 
124
124
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: Inquery::Mixins
8
8
 
9
- &mdash; Documentation by YARD 0.9.27
9
+ &mdash; Documentation by YARD 0.9.37
10
10
 
11
11
  </title>
12
12
 
@@ -107,9 +107,9 @@
107
107
  </div>
108
108
 
109
109
  <div id="footer">
110
- Generated on Thu May 19 10:36:15 2022 by
111
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
112
- 0.9.27 (ruby-3.0.1).
110
+ Generated on Mon Jan 5 14:06:48 2026 by
111
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
112
+ 0.9.37 (ruby-3.3.5).
113
113
  </div>
114
114
 
115
115
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Class: Inquery::Query::Chainable
8
8
 
9
- &mdash; Documentation by YARD 0.9.27
9
+ &mdash; Documentation by YARD 0.9.37
10
10
 
11
11
  </title>
12
12
 
@@ -106,7 +106,37 @@
106
106
 
107
107
  </div>
108
108
 
109
+ <h2>Overview</h2><div class="docstring">
110
+ <div class="discussion">
111
+
112
+ <p>Chainable query class for queries that input and output ActiveRecord relations.</p>
113
+
114
+ <p>Use this class when you want to build queries that can be chained together or used as ActiveRecord scopes. The query receives a relation, transforms it, and returns a new relation.</p>
115
+
116
+ <p>Example:</p>
117
+
118
+ <pre class="code ruby"><code class="ruby"><span class='kw'>class</span> <span class='const'>FetchActive</span> <span class='op'>&lt;</span> <span class='const'><span class='object_link'><a href="../../Inquery.html" title="Inquery (module)">Inquery</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Query.html" title="Inquery::Query (class)">Query</a></span></span><span class='op'>::</span><span class='const'>Chainable</span>
119
+ <span class='id identifier rubyid_relation'>relation</span> <span class='label'>class:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>User</span><span class='tstring_end'>&#39;</span></span>
120
+
121
+ <span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span>
122
+ <span class='id identifier rubyid_relation'>relation</span><span class='period'>.</span><span class='id identifier rubyid_where'>where</span><span class='lparen'>(</span><span class='label'>active:</span> <span class='kw'>true</span><span class='rparen'>)</span>
123
+ <span class='kw'>end</span>
124
+ <span class='kw'>end</span>
125
+
126
+ <span class='const'>User</span><span class='period'>.</span><span class='id identifier rubyid_all'>all</span><span class='period'>.</span><span class='id identifier rubyid_then'>then</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_rel'>rel</span><span class='op'>|</span> <span class='const'>FetchActive</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='id identifier rubyid_rel'>rel</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
127
+ <span class='comment'># Or as a scope:
128
+ </span><span class='kw'>class</span> <span class='const'>User</span> <span class='op'>&lt;</span> <span class='const'>ActiveRecord</span><span class='op'>::</span><span class='const'>Base</span>
129
+ <span class='id identifier rubyid_scope'>scope</span> <span class='symbol'>:active</span><span class='comma'>,</span> <span class='const'>FetchActive</span>
130
+ <span class='kw'>end</span>
131
+ </code></pre>
132
+
109
133
 
134
+ </div>
135
+ </div>
136
+ <div class="tags">
137
+
138
+
139
+ </div>
110
140
 
111
141
 
112
142
  <h2>Constant Summary</h2>
@@ -122,7 +152,7 @@
122
152
  <li class="public ">
123
153
  <span class="summary_signature">
124
154
 
125
- <a href="#relation-instance_method" title="#relation (instance method)">#<strong>relation</strong> &#x21d2; Object </a>
155
+ <a href="#relation-instance_method" title="#relation (instance method)">#<strong>relation</strong> &#x21d2; ActiveRecord::Relation </a>
126
156
 
127
157
 
128
158
 
@@ -141,7 +171,8 @@
141
171
 
142
172
 
143
173
 
144
- <span class="summary_desc"><div class='inline'><p>Returns the value of attribute relation.</p>
174
+ <span class="summary_desc"><div class='inline'>
175
+ <p>The input ActiveRecord relation that will be transformed by this query.</p>
145
176
  </div></span>
146
177
 
147
178
  </li>
@@ -168,7 +199,7 @@
168
199
  <li class="public ">
169
200
  <span class="summary_signature">
170
201
 
171
- <a href="#call-class_method" title="call (class method)">.<strong>call</strong>(*args) &#x21d2; Object </a>
202
+ <a href="#call-class_method" title="call (class method)">.<strong>call</strong>(*args) &#x21d2; ActiveRecord::Relation </a>
172
203
 
173
204
 
174
205
 
@@ -182,7 +213,8 @@
182
213
 
183
214
 
184
215
 
185
- <span class="summary_desc"><div class='inline'><p>Allows using this class as an AR scope.</p>
216
+ <span class="summary_desc"><div class='inline'>
217
+ <p>Instantiates the query and executes it, allowing use as an AR scope.</p>
186
218
  </div></span>
187
219
 
188
220
  </li>
@@ -200,29 +232,7 @@
200
232
  <li class="public ">
201
233
  <span class="summary_signature">
202
234
 
203
- <a href="#call-instance_method" title="#call (instance method)">#<strong>call</strong>(*args) &#x21d2; Object </a>
204
-
205
-
206
-
207
- </span>
208
-
209
-
210
-
211
-
212
-
213
-
214
-
215
-
216
-
217
- <span class="summary_desc"><div class='inline'></div></span>
218
-
219
- </li>
220
-
221
-
222
- <li class="public ">
223
- <span class="summary_signature">
224
-
225
- <a href="#connection-instance_method" title="#connection (instance method)">#<strong>connection</strong> &#x21d2; Object </a>
235
+ <a href="#connection-instance_method" title="#connection (instance method)">#<strong>connection</strong> &#x21d2; ActiveRecord::ConnectionAdapters::AbstractAdapter </a>
226
236
 
227
237
 
228
238
 
@@ -236,7 +246,8 @@
236
246
 
237
247
 
238
248
 
239
- <span class="summary_desc"><div class='inline'><p>Override the connection method to (re-)use the connection of the relation.</p>
249
+ <span class="summary_desc"><div class='inline'>
250
+ <p>Returns the database connection from the relation.</p>
240
251
  </div></span>
241
252
 
242
253
  </li>
@@ -261,7 +272,8 @@
261
272
 
262
273
 
263
274
 
264
- <span class="summary_desc"><div class='inline'><p>A new instance of Chainable.</p>
275
+ <span class="summary_desc"><div class='inline'>
276
+ <p>Initializes a chainable query with a relation and optional parameters.</p>
265
277
  </div></span>
266
278
 
267
279
  </li>
@@ -292,7 +304,7 @@
292
304
 
293
305
 
294
306
  <h3 class="inherited">Methods inherited from <span class='object_link'><a href="../Query.html" title="Inquery::Query (class)">Inquery::Query</a></span></h3>
295
- <p class="inherited"><span class='object_link'><a href="../Query.html#osparams-instance_method" title="Inquery::Query#osparams (method)">#osparams</a></span>, <span class='object_link'><a href="../Query.html#process-instance_method" title="Inquery::Query#process (method)">#process</a></span>, <span class='object_link'><a href="../Query.html#run-class_method" title="Inquery::Query.run (method)">run</a></span>, <span class='object_link'><a href="../Query.html#run-instance_method" title="Inquery::Query#run (method)">#run</a></span></p>
307
+ <p class="inherited"><span class='object_link'><a href="../Query.html#call-instance_method" title="Inquery::Query#call (method)">#call</a></span>, <span class='object_link'><a href="../Query.html#osparams-instance_method" title="Inquery::Query#osparams (method)">#osparams</a></span>, <span class='object_link'><a href="../Query.html#process-instance_method" title="Inquery::Query#process (method)">#process</a></span>, <span class='object_link'><a href="../Query.html#run-class_method" title="Inquery::Query.run (method)">run</a></span>, <span class='object_link'><a href="../Query.html#run-instance_method" title="Inquery::Query#run (method)">#run</a></span></p>
296
308
 
297
309
 
298
310
 
@@ -321,13 +333,74 @@
321
333
 
322
334
  </h3><div class="docstring">
323
335
  <div class="discussion">
324
- <p>Returns a new instance of Chainable.</p>
336
+
337
+ <p>Initializes a chainable query with a relation and optional parameters.</p>
338
+
339
+ <p>Supports multiple call signatures:</p>
340
+
341
+ <pre class="code ruby"><code class="ruby">new() - Uses default relation from &#39;relation&#39; DSL
342
+ new(relation) - Uses provided relation
343
+ new(params) - Uses default relation with params
344
+ new(relation, params) - Uses provided relation and params
345
+ </code></pre>
325
346
 
326
347
 
327
348
  </div>
328
349
  </div>
329
350
  <div class="tags">
351
+ <p class="tag_title">Parameters:</p>
352
+ <ul class="param">
353
+
354
+ <li>
355
+
356
+ <span class='name'>args</span>
357
+
358
+
359
+ <span class='type'>(<tt>Array</tt>)</span>
360
+
361
+
362
+
363
+ &mdash;
364
+ <div class='inline'>
365
+ <p>Variable arguments for relation and/or params</p>
366
+ </div>
367
+
368
+ </li>
330
369
 
370
+ </ul>
371
+
372
+ <p class="tag_title">Raises:</p>
373
+ <ul class="raise">
374
+
375
+ <li>
376
+
377
+
378
+ <span class='type'>(<tt><span class='object_link'><a href="../Exceptions/UnknownCallSignature.html" title="Inquery::Exceptions::UnknownCallSignature (class)">Inquery::Exceptions::UnknownCallSignature</a></span></tt>)</span>
379
+
380
+
381
+
382
+ &mdash;
383
+ <div class='inline'>
384
+ <p>for invalid arguments</p>
385
+ </div>
386
+
387
+ </li>
388
+
389
+ <li>
390
+
391
+
392
+ <span class='type'>(<tt><span class='object_link'><a href="../Exceptions/InvalidRelation.html" title="Inquery::Exceptions::InvalidRelation (class)">Inquery::Exceptions::InvalidRelation</a></span></tt>)</span>
393
+
394
+
395
+
396
+ &mdash;
397
+ <div class='inline'>
398
+ <p>if relation validation fails</p>
399
+ </div>
400
+
401
+ </li>
402
+
403
+ </ul>
331
404
 
332
405
  </div><table class="source_code">
333
406
  <tr>
@@ -335,14 +408,14 @@
335
408
  <pre class="lines">
336
409
 
337
410
 
338
- 16
339
- 17
340
- 18
341
- 19
342
- 20</pre>
411
+ 52
412
+ 53
413
+ 54
414
+ 55
415
+ 56</pre>
343
416
  </td>
344
417
  <td>
345
- <pre class="code"><span class="info file"># File 'lib/inquery/query/chainable.rb', line 16</span>
418
+ <pre class="code"><span class="info file"># File 'lib/inquery/query/chainable.rb', line 52</span>
346
419
 
347
420
  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
348
421
  <span class='id identifier rubyid_relation'>relation</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_init_args'>parse_init_args</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
@@ -364,7 +437,7 @@
364
437
  <div class="method_details first">
365
438
  <h3 class="signature first" id="relation-instance_method">
366
439
 
367
- #<strong>relation</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
440
+ #<strong>relation</strong> &#x21d2; <tt>ActiveRecord::Relation</tt> <span class="extras">(readonly)</span>
368
441
 
369
442
 
370
443
 
@@ -372,13 +445,27 @@
372
445
 
373
446
  </h3><div class="docstring">
374
447
  <div class="discussion">
375
- <p>Returns the value of attribute relation.</p>
448
+
449
+ <p>The input ActiveRecord relation that will be transformed by this query.</p>
376
450
 
377
451
 
378
452
  </div>
379
453
  </div>
380
454
  <div class="tags">
381
455
 
456
+ <p class="tag_title">Returns:</p>
457
+ <ul class="return">
458
+
459
+ <li>
460
+
461
+
462
+ <span class='type'>(<tt>ActiveRecord::Relation</tt>)</span>
463
+
464
+
465
+
466
+ </li>
467
+
468
+ </ul>
382
469
 
383
470
  </div><table class="source_code">
384
471
  <tr>
@@ -386,12 +473,12 @@
386
473
  <pre class="lines">
387
474
 
388
475
 
389
- 14
390
- 15
391
- 16</pre>
476
+ 39
477
+ 40
478
+ 41</pre>
392
479
  </td>
393
480
  <td>
394
- <pre class="code"><span class="info file"># File 'lib/inquery/query/chainable.rb', line 14</span>
481
+ <pre class="code"><span class="info file"># File 'lib/inquery/query/chainable.rb', line 39</span>
395
482
 
396
483
  <span class='kw'>def</span> <span class='id identifier rubyid_relation'>relation</span>
397
484
  <span class='ivar'>@relation</span>
@@ -411,7 +498,7 @@
411
498
  <div class="method_details first">
412
499
  <h3 class="signature first" id="call-class_method">
413
500
 
414
- .<strong>call</strong>(*args) &#x21d2; <tt>Object</tt>
501
+ .<strong>call</strong>(*args) &#x21d2; <tt>ActiveRecord::Relation</tt>
415
502
 
416
503
 
417
504
 
@@ -419,13 +506,57 @@
419
506
 
420
507
  </h3><div class="docstring">
421
508
  <div class="discussion">
422
- <p>Allows using this class as an AR scope.</p>
509
+
510
+ <p>Instantiates the query and executes it, allowing use as an AR scope.</p>
511
+
512
+ <p>This enables chainable queries to be used directly as ActiveRecord scopes:</p>
513
+
514
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_scope'>scope</span> <span class='symbol'>:active</span><span class='comma'>,</span> <span class='const'>FetchActive</span>
515
+ </code></pre>
423
516
 
424
517
 
425
518
  </div>
426
519
  </div>
427
520
  <div class="tags">
521
+ <p class="tag_title">Parameters:</p>
522
+ <ul class="param">
428
523
 
524
+ <li>
525
+
526
+ <span class='name'>args</span>
527
+
528
+
529
+ <span class='type'>(<tt>Array</tt>)</span>
530
+
531
+
532
+
533
+ &mdash;
534
+ <div class='inline'>
535
+ <p>Arguments passed to initialize (relation and/or params)</p>
536
+ </div>
537
+
538
+ </li>
539
+
540
+ </ul>
541
+
542
+ <p class="tag_title">Returns:</p>
543
+ <ul class="return">
544
+
545
+ <li>
546
+
547
+
548
+ <span class='type'>(<tt>ActiveRecord::Relation</tt>)</span>
549
+
550
+
551
+
552
+ &mdash;
553
+ <div class='inline'>
554
+ <p>The transformed relation</p>
555
+ </div>
556
+
557
+ </li>
558
+
559
+ </ul>
429
560
 
430
561
  </div><table class="source_code">
431
562
  <tr>
@@ -433,12 +564,12 @@
433
564
  <pre class="lines">
434
565
 
435
566
 
436
- 6
437
- 7
438
- 8</pre>
567
+ 32
568
+ 33
569
+ 34</pre>
439
570
  </td>
440
571
  <td>
441
- <pre class="code"><span class="info file"># File 'lib/inquery/query/chainable.rb', line 6</span>
572
+ <pre class="code"><span class="info file"># File 'lib/inquery/query/chainable.rb', line 32</span>
442
573
 
443
574
  <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='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
444
575
  <span class='kw'>return</span> <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>
@@ -455,39 +586,9 @@
455
586
 
456
587
 
457
588
  <div class="method_details first">
458
- <h3 class="signature first" id="call-instance_method">
459
-
460
- #<strong>call</strong>(*args) &#x21d2; <tt>Object</tt>
461
-
462
-
463
-
464
-
465
-
466
- </h3><table class="source_code">
467
- <tr>
468
- <td>
469
- <pre class="lines">
470
-
471
-
472
- 10
473
- 11
474
- 12</pre>
475
- </td>
476
- <td>
477
- <pre class="code"><span class="info file"># File 'lib/inquery/query/chainable.rb', line 10</span>
478
-
479
- <span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
480
- <span class='id identifier rubyid_fail'>fail</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span>
481
- <span class='kw'>end</span></pre>
482
- </td>
483
- </tr>
484
- </table>
485
- </div>
486
-
487
- <div class="method_details ">
488
- <h3 class="signature " id="connection-instance_method">
589
+ <h3 class="signature first" id="connection-instance_method">
489
590
 
490
- #<strong>connection</strong> &#x21d2; <tt>Object</tt>
591
+ #<strong>connection</strong> &#x21d2; <tt>ActiveRecord::ConnectionAdapters::AbstractAdapter</tt>
491
592
 
492
593
 
493
594
 
@@ -495,13 +596,29 @@
495
596
 
496
597
  </h3><div class="docstring">
497
598
  <div class="discussion">
498
- <p>Override the connection method to (re-)use the connection of the relation</p>
599
+
600
+ <p>Returns the database connection from the relation.</p>
601
+
602
+ <p>This ensures that the query uses the same connection as the input relation, which is important for connection pooling and transactions.</p>
499
603
 
500
604
 
501
605
  </div>
502
606
  </div>
503
607
  <div class="tags">
504
608
 
609
+ <p class="tag_title">Returns:</p>
610
+ <ul class="return">
611
+
612
+ <li>
613
+
614
+
615
+ <span class='type'>(<tt>ActiveRecord::ConnectionAdapters::AbstractAdapter</tt>)</span>
616
+
617
+
618
+
619
+ </li>
620
+
621
+ </ul>
505
622
 
506
623
  </div><table class="source_code">
507
624
  <tr>
@@ -509,12 +626,12 @@
509
626
  <pre class="lines">
510
627
 
511
628
 
512
- 23
513
- 24
514
- 25</pre>
629
+ 64
630
+ 65
631
+ 66</pre>
515
632
  </td>
516
633
  <td>
517
- <pre class="code"><span class="info file"># File 'lib/inquery/query/chainable.rb', line 23</span>
634
+ <pre class="code"><span class="info file"># File 'lib/inquery/query/chainable.rb', line 64</span>
518
635
 
519
636
  <span class='kw'>def</span> <span class='id identifier rubyid_connection'>connection</span>
520
637
  <span class='ivar'>@relation</span><span class='period'>.</span><span class='id identifier rubyid_connection'>connection</span>
@@ -529,9 +646,9 @@
529
646
  </div>
530
647
 
531
648
  <div id="footer">
532
- Generated on Thu May 19 10:36:15 2022 by
533
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
534
- 0.9.27 (ruby-3.0.1).
649
+ Generated on Mon Jan 5 14:06:48 2026 by
650
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
651
+ 0.9.37 (ruby-3.3.5).
535
652
  </div>
536
653
 
537
654
  </div>