inquery 1.1.0 → 1.1.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/Gemfile.lock +2 -2
- data/README.md +5 -2
- data/VERSION +1 -1
- data/doc/Inquery/Exceptions/Base.html +1 -1
- data/doc/Inquery/Exceptions/InvalidRelation.html +1 -1
- data/doc/Inquery/Exceptions/UnknownCallSignature.html +1 -1
- data/doc/Inquery/Exceptions.html +1 -1
- data/doc/Inquery/MethodAccessibleHash.html +469 -51
- data/doc/Inquery/Mixins/RawSqlUtils.html +1 -1
- data/doc/Inquery/Mixins/RelationValidation/ClassMethods.html +1 -1
- data/doc/Inquery/Mixins/RelationValidation.html +1 -1
- data/doc/Inquery/Mixins/SchemaValidation/ClassMethods.html +1 -1
- data/doc/Inquery/Mixins/SchemaValidation.html +1 -1
- data/doc/Inquery/Mixins.html +1 -1
- data/doc/Inquery/Query/Chainable.html +1 -1
- data/doc/Inquery/Query.html +1 -1
- data/doc/Inquery.html +1 -1
- data/doc/_index.html +1 -1
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +6 -3
- data/doc/index.html +6 -3
- data/doc/method_list.html +57 -9
- data/doc/top-level-namespace.html +1 -1
- data/inquery.gemspec +3 -3
- data/lib/inquery/method_accessible_hash.rb +100 -15
- data/test/inquery/method_accessible_hash_test.rb +133 -5
- metadata +2 -2
|
@@ -69,13 +69,11 @@
|
|
|
69
69
|
<dl>
|
|
70
70
|
<dt>Inherits:</dt>
|
|
71
71
|
<dd>
|
|
72
|
-
<span class="inheritName">
|
|
72
|
+
<span class="inheritName">Object</span>
|
|
73
73
|
|
|
74
74
|
<ul class="fullTree">
|
|
75
75
|
<li>Object</li>
|
|
76
76
|
|
|
77
|
-
<li class="next">Hash</li>
|
|
78
|
-
|
|
79
77
|
<li class="next">Inquery::MethodAccessibleHash</li>
|
|
80
78
|
|
|
81
79
|
</ul>
|
|
@@ -104,11 +102,34 @@
|
|
|
104
102
|
<h2>Overview</h2><div class="docstring">
|
|
105
103
|
<div class="discussion">
|
|
106
104
|
|
|
107
|
-
<p>A safe alternative for OpenStruct in Ruby. It
|
|
105
|
+
<p>A safe alternative for ‘OpenStruct` in Ruby. It provides convenient method access to a set of key-value pairs, just like `OpenStruct`, but uses `method_missing` instead of defining methods on-the-fly.</p>
|
|
106
|
+
|
|
107
|
+
<p>Unlike a ‘Hash`, this class deliberately does <strong>not</strong> inherit from `Hash` (or include `Enumerable`). If it did, keys whose names collide with `Hash` / `Enumerable` methods (e.g. `group_by`, `count`, `zip`, `select`, …) would invoke the inherited method instead of returning the stored value, because `method_missing` is only called for methods that are not already defined.</p>
|
|
108
108
|
|
|
109
109
|
<p>Usage example:</p>
|
|
110
110
|
|
|
111
|
-
<p>“‘ruby default_options = { foo: :bar } options = MethodAccessibleHash.new(default_options) <a href=":color">options</a> = :green options.foo # => :bar options.color # => green “`</p>
|
|
111
|
+
<p>“‘ruby default_options = { foo: :bar } options = MethodAccessibleHash.new(default_options) <a href=":color">options</a> = :green options.foo # => :bar options.color # => :green “`</p>
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
<div class="tags">
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
<h2>
|
|
122
|
+
Constant Summary
|
|
123
|
+
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
|
|
124
|
+
</h2>
|
|
125
|
+
|
|
126
|
+
<dl class="constants">
|
|
127
|
+
|
|
128
|
+
<dt id="CONVERSION_METHODS-constant" class="">CONVERSION_METHODS =
|
|
129
|
+
<div class="docstring">
|
|
130
|
+
<div class="discussion">
|
|
131
|
+
|
|
132
|
+
<p>Methods that participate in Ruby’s implicit type-coercion protocol. We must neither pretend to respond to these (‘respond_to_missing?`) nor fabricate a `nil` value for them (`method_missing`). Otherwise constructs such as `**hash`, `Hash(obj)`, `Array(obj)` or Rails’ implicit conversions would detect the method, call it, receive ‘nil` and raise a `TypeError`. Keys actually present under one of these names are still returned normally.</p>
|
|
112
133
|
|
|
113
134
|
|
|
114
135
|
</div>
|
|
@@ -117,6 +138,12 @@
|
|
|
117
138
|
|
|
118
139
|
|
|
119
140
|
</div>
|
|
141
|
+
</dt>
|
|
142
|
+
<dd><pre class="code"><span class='qsymbols_beg'>%i[</span><span class='tstring_content'>to_ary</span><span class='words_sep'> </span><span class='tstring_content'>to_a</span><span class='words_sep'> </span><span class='tstring_content'>to_hash</span><span class='words_sep'> </span><span class='tstring_content'>to_str</span><span class='words_sep'> </span><span class='tstring_content'>to_int</span><span class='words_sep'> </span><span class='tstring_content'>to_proc</span><span class='tstring_end'>]</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
|
143
|
+
|
|
144
|
+
</dl>
|
|
145
|
+
|
|
146
|
+
|
|
120
147
|
|
|
121
148
|
|
|
122
149
|
|
|
@@ -134,6 +161,98 @@
|
|
|
134
161
|
<li class="public ">
|
|
135
162
|
<span class="summary_signature">
|
|
136
163
|
|
|
164
|
+
<a href="#==-instance_method" title="#== (instance method)">#<strong>==</strong>(other) ⇒ Object </a>
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
</span>
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
179
|
+
|
|
180
|
+
</li>
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
<li class="public ">
|
|
184
|
+
<span class="summary_signature">
|
|
185
|
+
|
|
186
|
+
<a href="#[]-instance_method" title="#[] (instance method)">#<strong>[]</strong>(key) ⇒ Object </a>
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
</span>
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
<span class="summary_desc"><div class='inline'>
|
|
201
|
+
<p>Returns the value stored under the given key.</p>
|
|
202
|
+
</div></span>
|
|
203
|
+
|
|
204
|
+
</li>
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
<li class="public ">
|
|
208
|
+
<span class="summary_signature">
|
|
209
|
+
|
|
210
|
+
<a href="#[]=-instance_method" title="#[]= (instance method)">#<strong>[]=</strong>(key, value) ⇒ Object </a>
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
</span>
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
<span class="summary_desc"><div class='inline'>
|
|
225
|
+
<p>Stores the given value under the given (symbolized) key.</p>
|
|
226
|
+
</div></span>
|
|
227
|
+
|
|
228
|
+
</li>
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
<li class="public ">
|
|
232
|
+
<span class="summary_signature">
|
|
233
|
+
|
|
234
|
+
<a href="#freeze-instance_method" title="#freeze (instance method)">#<strong>freeze</strong> ⇒ Object </a>
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
</span>
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
249
|
+
|
|
250
|
+
</li>
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
<li class="public ">
|
|
254
|
+
<span class="summary_signature">
|
|
255
|
+
|
|
137
256
|
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(hash = {}) ⇒ MethodAccessibleHash </a>
|
|
138
257
|
|
|
139
258
|
|
|
@@ -160,7 +279,7 @@
|
|
|
160
279
|
<li class="public ">
|
|
161
280
|
<span class="summary_signature">
|
|
162
281
|
|
|
163
|
-
<a href="#merge-instance_method" title="#merge (instance method)">#<strong>merge</strong>(
|
|
282
|
+
<a href="#merge-instance_method" title="#merge (instance method)">#<strong>merge</strong>(other = {}) ⇒ Object </a>
|
|
164
283
|
|
|
165
284
|
|
|
166
285
|
|
|
@@ -174,7 +293,9 @@
|
|
|
174
293
|
|
|
175
294
|
|
|
176
295
|
|
|
177
|
-
<span class="summary_desc"><div class='inline'
|
|
296
|
+
<span class="summary_desc"><div class='inline'>
|
|
297
|
+
<p>Returns a new MethodAccessibleHash with the given hash merged in.</p>
|
|
298
|
+
</div></span>
|
|
178
299
|
|
|
179
300
|
</li>
|
|
180
301
|
|
|
@@ -204,7 +325,7 @@
|
|
|
204
325
|
<li class="public ">
|
|
205
326
|
<span class="summary_signature">
|
|
206
327
|
|
|
207
|
-
<a href="#respond_to_missing%3F-instance_method" title="#respond_to_missing? (instance method)">#<strong>respond_to_missing?</strong>(
|
|
328
|
+
<a href="#respond_to_missing%3F-instance_method" title="#respond_to_missing? (instance method)">#<strong>respond_to_missing?</strong>(method, _include_private = false) ⇒ Boolean </a>
|
|
208
329
|
|
|
209
330
|
|
|
210
331
|
|
|
@@ -223,11 +344,58 @@
|
|
|
223
344
|
</li>
|
|
224
345
|
|
|
225
346
|
|
|
226
|
-
|
|
347
|
+
<li class="public ">
|
|
348
|
+
<span class="summary_signature">
|
|
349
|
+
|
|
350
|
+
<a href="#to_h-instance_method" title="#to_h (instance method)">#<strong>to_h</strong> ⇒ Object </a>
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
</span>
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
<span class="summary_desc"><div class='inline'>
|
|
365
|
+
<p>Returns a (shallow) copy of the underlying data as a plain Hash with symbol keys.</p>
|
|
366
|
+
</div></span>
|
|
367
|
+
|
|
368
|
+
</li>
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
<li class="public ">
|
|
372
|
+
<span class="summary_signature">
|
|
373
|
+
|
|
374
|
+
<a href="#to_s-instance_method" title="#to_s (instance method)">#<strong>to_s</strong> ⇒ Object </a>
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
(also: #inspect)
|
|
379
|
+
|
|
380
|
+
</span>
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
|
|
227
387
|
|
|
228
388
|
|
|
389
|
+
|
|
390
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
391
|
+
|
|
392
|
+
</li>
|
|
229
393
|
|
|
230
|
-
|
|
394
|
+
|
|
395
|
+
</ul>
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
<div id="constructor_details" class="method_details_list">
|
|
231
399
|
<h2>Constructor Details</h2>
|
|
232
400
|
|
|
233
401
|
<div class="method_details first">
|
|
@@ -242,7 +410,7 @@
|
|
|
242
410
|
</h3><div class="docstring">
|
|
243
411
|
<div class="discussion">
|
|
244
412
|
|
|
245
|
-
<p>Takes an optional hash as argument and constructs a new MethodAccessibleHash.</p>
|
|
413
|
+
<p>Takes an optional hash as argument and constructs a new MethodAccessibleHash. Keys are symbolized.</p>
|
|
246
414
|
|
|
247
415
|
|
|
248
416
|
</div>
|
|
@@ -256,22 +424,20 @@
|
|
|
256
424
|
<pre class="lines">
|
|
257
425
|
|
|
258
426
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
23</pre>
|
|
427
|
+
33
|
|
428
|
+
34
|
|
429
|
+
35
|
|
430
|
+
36
|
|
431
|
+
37
|
|
432
|
+
38</pre>
|
|
266
433
|
</td>
|
|
267
434
|
<td>
|
|
268
|
-
<pre class="code"><span class="info file"># File 'lib/inquery/method_accessible_hash.rb', line
|
|
435
|
+
<pre class="code"><span class="info file"># File 'lib/inquery/method_accessible_hash.rb', line 33</span>
|
|
269
436
|
|
|
270
437
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
|
271
|
-
<span class='
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
<span class='kw'>self</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
|
438
|
+
<span class='ivar'>@table</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
|
439
|
+
<span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span><span class='period'>.</span><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>
|
|
440
|
+
<span class='ivar'>@table</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
|
275
441
|
<span class='kw'>end</span>
|
|
276
442
|
<span class='kw'>end</span></pre>
|
|
277
443
|
</td>
|
|
@@ -302,24 +468,28 @@
|
|
|
302
468
|
<pre class="lines">
|
|
303
469
|
|
|
304
470
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
471
|
+
89
|
|
472
|
+
90
|
|
473
|
+
91
|
|
474
|
+
92
|
|
475
|
+
93
|
|
476
|
+
94
|
|
477
|
+
95
|
|
478
|
+
96
|
|
479
|
+
97
|
|
480
|
+
98</pre>
|
|
313
481
|
</td>
|
|
314
482
|
<td>
|
|
315
|
-
<pre class="code"><span class="info file"># File 'lib/inquery/method_accessible_hash.rb', line
|
|
483
|
+
<pre class="code"><span class="info file"># File 'lib/inquery/method_accessible_hash.rb', line 89</span>
|
|
316
484
|
|
|
317
485
|
<span class='kw'>def</span> <span class='id identifier rubyid_method_missing'>method_missing</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid__block'>_block</span><span class='rparen'>)</span>
|
|
318
|
-
<span class='
|
|
319
|
-
|
|
320
|
-
<span class='kw'>self</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
|
486
|
+
<span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
|
487
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_end_with?'>end_with?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>=</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
|
488
|
+
<span class='kw'>self</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>..</span><span class='op'>-</span><span class='int'>2</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
|
489
|
+
<span class='kw'>elsif</span> <span class='const'><span class='object_link'><a href="#CONVERSION_METHODS-constant" title="Inquery::MethodAccessibleHash::CONVERSION_METHODS (constant)">CONVERSION_METHODS</a></span></span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='op'>!</span><span class='ivar'>@table</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span>
|
|
490
|
+
<span class='kw'>super</span>
|
|
321
491
|
<span class='kw'>else</span>
|
|
322
|
-
<span class='
|
|
492
|
+
<span class='ivar'>@table</span><span class='lbracket'>[</span><span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span>
|
|
323
493
|
<span class='kw'>end</span>
|
|
324
494
|
<span class='kw'>end</span></pre>
|
|
325
495
|
</td>
|
|
@@ -335,9 +505,9 @@
|
|
|
335
505
|
|
|
336
506
|
|
|
337
507
|
<div class="method_details first">
|
|
338
|
-
<h3 class="signature first" id="
|
|
508
|
+
<h3 class="signature first" id="==-instance_method">
|
|
339
509
|
|
|
340
|
-
#<strong
|
|
510
|
+
#<strong>==</strong>(other) ⇒ <tt>Object</tt>
|
|
341
511
|
|
|
342
512
|
|
|
343
513
|
|
|
@@ -349,15 +519,184 @@
|
|
|
349
519
|
<pre class="lines">
|
|
350
520
|
|
|
351
521
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
522
|
+
65
|
|
523
|
+
66
|
|
524
|
+
67
|
|
525
|
+
68
|
|
526
|
+
69
|
|
527
|
+
70
|
|
528
|
+
71
|
|
529
|
+
72
|
|
530
|
+
73
|
|
531
|
+
74</pre>
|
|
355
532
|
</td>
|
|
356
533
|
<td>
|
|
357
|
-
<pre class="code"><span class="info file"># File 'lib/inquery/method_accessible_hash.rb', line
|
|
534
|
+
<pre class="code"><span class="info file"># File 'lib/inquery/method_accessible_hash.rb', line 65</span>
|
|
535
|
+
|
|
536
|
+
<span class='kw'>def</span> <span class='op'>==</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
|
|
537
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_other'>other</span>
|
|
538
|
+
<span class='kw'>when</span> <span class='const'><span class='object_link'><a href="" title="Inquery::MethodAccessibleHash (class)">MethodAccessibleHash</a></span></span>
|
|
539
|
+
<span class='id identifier rubyid_to_h'>to_h</span> <span class='op'>==</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_to_h'>to_h</span>
|
|
540
|
+
<span class='kw'>when</span> <span class='op'>::</span><span class='const'>Hash</span>
|
|
541
|
+
<span class='id identifier rubyid_to_h'>to_h</span> <span class='op'>==</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_symbolize_keys'>symbolize_keys</span>
|
|
542
|
+
<span class='kw'>else</span>
|
|
543
|
+
<span class='kw'>false</span>
|
|
544
|
+
<span class='kw'>end</span>
|
|
545
|
+
<span class='kw'>end</span></pre>
|
|
546
|
+
</td>
|
|
547
|
+
</tr>
|
|
548
|
+
</table>
|
|
549
|
+
</div>
|
|
550
|
+
|
|
551
|
+
<div class="method_details ">
|
|
552
|
+
<h3 class="signature " id="[]-instance_method">
|
|
553
|
+
|
|
554
|
+
#<strong>[]</strong>(key) ⇒ <tt>Object</tt>
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
</h3><div class="docstring">
|
|
561
|
+
<div class="discussion">
|
|
562
|
+
|
|
563
|
+
<p>Returns the value stored under the given key. Keys are accessed indifferently as the storage is symbolized.</p>
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
</div>
|
|
567
|
+
</div>
|
|
568
|
+
<div class="tags">
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
</div><table class="source_code">
|
|
572
|
+
<tr>
|
|
573
|
+
<td>
|
|
574
|
+
<pre class="lines">
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
42
|
|
578
|
+
43
|
|
579
|
+
44</pre>
|
|
580
|
+
</td>
|
|
581
|
+
<td>
|
|
582
|
+
<pre class="code"><span class="info file"># File 'lib/inquery/method_accessible_hash.rb', line 42</span>
|
|
583
|
+
|
|
584
|
+
<span class='kw'>def</span> <span class='op'>[]</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
|
585
|
+
<span class='ivar'>@table</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span>
|
|
586
|
+
<span class='kw'>end</span></pre>
|
|
587
|
+
</td>
|
|
588
|
+
</tr>
|
|
589
|
+
</table>
|
|
590
|
+
</div>
|
|
591
|
+
|
|
592
|
+
<div class="method_details ">
|
|
593
|
+
<h3 class="signature " id="[]=-instance_method">
|
|
594
|
+
|
|
595
|
+
#<strong>[]=</strong>(key, value) ⇒ <tt>Object</tt>
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
</h3><div class="docstring">
|
|
602
|
+
<div class="discussion">
|
|
603
|
+
|
|
604
|
+
<p>Stores the given value under the given (symbolized) key. Modifying a frozen instance raises a ‘FrozenError`, because `@table` is frozen alongside the instance (see `freeze` and `initialize_copy`).</p>
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
</div>
|
|
608
|
+
</div>
|
|
609
|
+
<div class="tags">
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
</div><table class="source_code">
|
|
613
|
+
<tr>
|
|
614
|
+
<td>
|
|
615
|
+
<pre class="lines">
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
49
|
|
619
|
+
50
|
|
620
|
+
51</pre>
|
|
621
|
+
</td>
|
|
622
|
+
<td>
|
|
623
|
+
<pre class="code"><span class="info file"># File 'lib/inquery/method_accessible_hash.rb', line 49</span>
|
|
624
|
+
|
|
625
|
+
<span class='kw'>def</span> <span class='op'>[]=</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
|
626
|
+
<span class='ivar'>@table</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
|
627
|
+
<span class='kw'>end</span></pre>
|
|
628
|
+
</td>
|
|
629
|
+
</tr>
|
|
630
|
+
</table>
|
|
631
|
+
</div>
|
|
632
|
+
|
|
633
|
+
<div class="method_details ">
|
|
634
|
+
<h3 class="signature " id="freeze-instance_method">
|
|
635
|
+
|
|
636
|
+
#<strong>freeze</strong> ⇒ <tt>Object</tt>
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
</h3><table class="source_code">
|
|
643
|
+
<tr>
|
|
644
|
+
<td>
|
|
645
|
+
<pre class="lines">
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
83
|
|
649
|
+
84
|
|
650
|
+
85
|
|
651
|
+
86</pre>
|
|
652
|
+
</td>
|
|
653
|
+
<td>
|
|
654
|
+
<pre class="code"><span class="info file"># File 'lib/inquery/method_accessible_hash.rb', line 83</span>
|
|
655
|
+
|
|
656
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_freeze'>freeze</span>
|
|
657
|
+
<span class='ivar'>@table</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span>
|
|
658
|
+
<span class='kw'>super</span>
|
|
659
|
+
<span class='kw'>end</span></pre>
|
|
660
|
+
</td>
|
|
661
|
+
</tr>
|
|
662
|
+
</table>
|
|
663
|
+
</div>
|
|
664
|
+
|
|
665
|
+
<div class="method_details ">
|
|
666
|
+
<h3 class="signature " id="merge-instance_method">
|
|
667
|
+
|
|
668
|
+
#<strong>merge</strong>(other = {}) ⇒ <tt>Object</tt>
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
</h3><div class="docstring">
|
|
675
|
+
<div class="discussion">
|
|
676
|
+
|
|
677
|
+
<p>Returns a new MethodAccessibleHash with the given hash merged in.</p>
|
|
358
678
|
|
|
359
|
-
|
|
360
|
-
|
|
679
|
+
|
|
680
|
+
</div>
|
|
681
|
+
</div>
|
|
682
|
+
<div class="tags">
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
</div><table class="source_code">
|
|
686
|
+
<tr>
|
|
687
|
+
<td>
|
|
688
|
+
<pre class="lines">
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
60
|
|
692
|
+
61
|
|
693
|
+
62</pre>
|
|
694
|
+
</td>
|
|
695
|
+
<td>
|
|
696
|
+
<pre class="code"><span class="info file"># File 'lib/inquery/method_accessible_hash.rb', line 60</span>
|
|
697
|
+
|
|
698
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
|
699
|
+
<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><span class='lparen'>(</span><span class='id identifier rubyid_to_h'>to_h</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_to_h'>to_h</span><span class='period'>.</span><span class='id identifier rubyid_symbolize_keys'>symbolize_keys</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
|
361
700
|
<span class='kw'>end</span></pre>
|
|
362
701
|
</td>
|
|
363
702
|
</tr>
|
|
@@ -367,7 +706,7 @@
|
|
|
367
706
|
<div class="method_details ">
|
|
368
707
|
<h3 class="signature " id="respond_to_missing?-instance_method">
|
|
369
708
|
|
|
370
|
-
#<strong>respond_to_missing?</strong>(
|
|
709
|
+
#<strong>respond_to_missing?</strong>(method, _include_private = false) ⇒ <tt>Boolean</tt>
|
|
371
710
|
|
|
372
711
|
|
|
373
712
|
|
|
@@ -401,19 +740,98 @@
|
|
|
401
740
|
<pre class="lines">
|
|
402
741
|
|
|
403
742
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
743
|
+
101
|
|
744
|
+
102
|
|
745
|
+
103
|
|
746
|
+
104
|
|
747
|
+
105</pre>
|
|
407
748
|
</td>
|
|
408
749
|
<td>
|
|
409
|
-
<pre class="code"><span class="info file"># File 'lib/inquery/method_accessible_hash.rb', line
|
|
750
|
+
<pre class="code"><span class="info file"># File 'lib/inquery/method_accessible_hash.rb', line 101</span>
|
|
751
|
+
|
|
752
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_respond_to_missing?'>respond_to_missing?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid__include_private'>_include_private</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
|
753
|
+
<span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='const'><span class='object_link'><a href="#CONVERSION_METHODS-constant" title="Inquery::MethodAccessibleHash::CONVERSION_METHODS (constant)">CONVERSION_METHODS</a></span></span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='op'>!</span><span class='ivar'>@table</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span>
|
|
410
754
|
|
|
411
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_respond_to_missing?'>respond_to_missing?</span><span class='lparen'>(</span><span class='id identifier rubyid__method'>_method</span><span class='comma'>,</span> <span class='id identifier rubyid__include_private'>_include_private</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
|
412
755
|
<span class='kw'>true</span>
|
|
413
756
|
<span class='kw'>end</span></pre>
|
|
414
757
|
</td>
|
|
415
758
|
</tr>
|
|
416
759
|
</table>
|
|
760
|
+
</div>
|
|
761
|
+
|
|
762
|
+
<div class="method_details ">
|
|
763
|
+
<h3 class="signature " id="to_h-instance_method">
|
|
764
|
+
|
|
765
|
+
#<strong>to_h</strong> ⇒ <tt>Object</tt>
|
|
766
|
+
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
</h3><div class="docstring">
|
|
772
|
+
<div class="discussion">
|
|
773
|
+
|
|
774
|
+
<p>Returns a (shallow) copy of the underlying data as a plain Hash with symbol keys.</p>
|
|
775
|
+
|
|
776
|
+
|
|
777
|
+
</div>
|
|
778
|
+
</div>
|
|
779
|
+
<div class="tags">
|
|
780
|
+
|
|
781
|
+
|
|
782
|
+
</div><table class="source_code">
|
|
783
|
+
<tr>
|
|
784
|
+
<td>
|
|
785
|
+
<pre class="lines">
|
|
786
|
+
|
|
787
|
+
|
|
788
|
+
55
|
|
789
|
+
56
|
|
790
|
+
57</pre>
|
|
791
|
+
</td>
|
|
792
|
+
<td>
|
|
793
|
+
<pre class="code"><span class="info file"># File 'lib/inquery/method_accessible_hash.rb', line 55</span>
|
|
794
|
+
|
|
795
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_h'>to_h</span>
|
|
796
|
+
<span class='ivar'>@table</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span>
|
|
797
|
+
<span class='kw'>end</span></pre>
|
|
798
|
+
</td>
|
|
799
|
+
</tr>
|
|
800
|
+
</table>
|
|
801
|
+
</div>
|
|
802
|
+
|
|
803
|
+
<div class="method_details ">
|
|
804
|
+
<h3 class="signature " id="to_s-instance_method">
|
|
805
|
+
|
|
806
|
+
#<strong>to_s</strong> ⇒ <tt>Object</tt>
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
<span class="aliases">Also known as:
|
|
811
|
+
<span class="names"><span id='inspect-instance_method'>inspect</span></span>
|
|
812
|
+
</span>
|
|
813
|
+
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
</h3><table class="source_code">
|
|
817
|
+
<tr>
|
|
818
|
+
<td>
|
|
819
|
+
<pre class="lines">
|
|
820
|
+
|
|
821
|
+
|
|
822
|
+
77
|
|
823
|
+
78
|
|
824
|
+
79</pre>
|
|
825
|
+
</td>
|
|
826
|
+
<td>
|
|
827
|
+
<pre class="code"><span class="info file"># File 'lib/inquery/method_accessible_hash.rb', line 77</span>
|
|
828
|
+
|
|
829
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
|
|
830
|
+
<span class='ivar'>@table</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
|
831
|
+
<span class='kw'>end</span></pre>
|
|
832
|
+
</td>
|
|
833
|
+
</tr>
|
|
834
|
+
</table>
|
|
417
835
|
</div>
|
|
418
836
|
|
|
419
837
|
</div>
|
|
@@ -421,7 +839,7 @@
|
|
|
421
839
|
</div>
|
|
422
840
|
|
|
423
841
|
<div id="footer">
|
|
424
|
-
Generated on Mon
|
|
842
|
+
Generated on Mon Jun 15 10:47:42 2026 by
|
|
425
843
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
426
844
|
0.9.37 (ruby-3.3.5).
|
|
427
845
|
</div>
|