jsonapi_compliable 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.travis.yml +11 -3
- data/.yardopts +1 -0
- data/README.md +10 -1
- data/Rakefile +1 -0
- data/docs/JsonapiCompliable.html +202 -0
- data/docs/JsonapiCompliable/Adapters.html +119 -0
- data/docs/JsonapiCompliable/Adapters/Abstract.html +2285 -0
- data/docs/JsonapiCompliable/Adapters/ActiveRecord.html +2151 -0
- data/docs/JsonapiCompliable/Adapters/ActiveRecordSideloading.html +582 -0
- data/docs/JsonapiCompliable/Adapters/Null.html +1682 -0
- data/docs/JsonapiCompliable/Base.html +1395 -0
- data/docs/JsonapiCompliable/Deserializer.html +835 -0
- data/docs/JsonapiCompliable/Errors.html +115 -0
- data/docs/JsonapiCompliable/Errors/BadFilter.html +124 -0
- data/docs/JsonapiCompliable/Errors/StatNotFound.html +266 -0
- data/docs/JsonapiCompliable/Errors/UnsupportedPageSize.html +264 -0
- data/docs/JsonapiCompliable/Errors/ValidationError.html +124 -0
- data/docs/JsonapiCompliable/Extensions.html +117 -0
- data/docs/JsonapiCompliable/Extensions/BooleanAttribute.html +212 -0
- data/docs/JsonapiCompliable/Extensions/BooleanAttribute/ClassMethods.html +229 -0
- data/docs/JsonapiCompliable/Extensions/ExtraAttribute.html +242 -0
- data/docs/JsonapiCompliable/Extensions/ExtraAttribute/ClassMethods.html +237 -0
- data/docs/JsonapiCompliable/Query.html +1099 -0
- data/docs/JsonapiCompliable/Rails.html +211 -0
- data/docs/JsonapiCompliable/Resource.html +5241 -0
- data/docs/JsonapiCompliable/Scope.html +703 -0
- data/docs/JsonapiCompliable/Scoping.html +117 -0
- data/docs/JsonapiCompliable/Scoping/Base.html +843 -0
- data/docs/JsonapiCompliable/Scoping/DefaultFilter.html +318 -0
- data/docs/JsonapiCompliable/Scoping/ExtraFields.html +301 -0
- data/docs/JsonapiCompliable/Scoping/Filter.html +313 -0
- data/docs/JsonapiCompliable/Scoping/Filterable.html +364 -0
- data/docs/JsonapiCompliable/Scoping/Paginate.html +613 -0
- data/docs/JsonapiCompliable/Scoping/Sort.html +454 -0
- data/docs/JsonapiCompliable/SerializableTempId.html +216 -0
- data/docs/JsonapiCompliable/Sideload.html +2484 -0
- data/docs/JsonapiCompliable/Stats.html +117 -0
- data/docs/JsonapiCompliable/Stats/DSL.html +999 -0
- data/docs/JsonapiCompliable/Stats/Payload.html +391 -0
- data/docs/JsonapiCompliable/Util.html +117 -0
- data/docs/JsonapiCompliable/Util/FieldParams.html +228 -0
- data/docs/JsonapiCompliable/Util/Hash.html +471 -0
- data/docs/JsonapiCompliable/Util/IncludeParams.html +299 -0
- data/docs/JsonapiCompliable/Util/Persistence.html +435 -0
- data/docs/JsonapiCompliable/Util/RelationshipPayload.html +563 -0
- data/docs/JsonapiCompliable/Util/RenderOptions.html +250 -0
- data/docs/JsonapiCompliable/Util/ValidationResponse.html +532 -0
- data/docs/_index.html +527 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +492 -0
- data/docs/file.README.html +99 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +99 -0
- data/docs/js/app.js +248 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +1731 -0
- data/docs/top-level-namespace.html +110 -0
- data/gemfiles/rails_5.gemfile +1 -1
- data/lib/jsonapi_compliable/adapters/abstract.rb +267 -4
- data/lib/jsonapi_compliable/adapters/active_record.rb +23 -1
- data/lib/jsonapi_compliable/adapters/null.rb +43 -3
- data/lib/jsonapi_compliable/base.rb +182 -33
- data/lib/jsonapi_compliable/deserializer.rb +90 -21
- data/lib/jsonapi_compliable/extensions/boolean_attribute.rb +12 -0
- data/lib/jsonapi_compliable/extensions/extra_attribute.rb +32 -0
- data/lib/jsonapi_compliable/extensions/temp_id.rb +11 -0
- data/lib/jsonapi_compliable/query.rb +94 -2
- data/lib/jsonapi_compliable/rails.rb +8 -0
- data/lib/jsonapi_compliable/resource.rb +548 -11
- data/lib/jsonapi_compliable/scope.rb +43 -1
- data/lib/jsonapi_compliable/scoping/base.rb +59 -8
- data/lib/jsonapi_compliable/scoping/default_filter.rb +33 -0
- data/lib/jsonapi_compliable/scoping/extra_fields.rb +33 -0
- data/lib/jsonapi_compliable/scoping/filter.rb +29 -2
- data/lib/jsonapi_compliable/scoping/filterable.rb +4 -0
- data/lib/jsonapi_compliable/scoping/paginate.rb +33 -0
- data/lib/jsonapi_compliable/scoping/sort.rb +18 -0
- data/lib/jsonapi_compliable/sideload.rb +229 -1
- data/lib/jsonapi_compliable/stats/dsl.rb +44 -0
- data/lib/jsonapi_compliable/stats/payload.rb +20 -0
- data/lib/jsonapi_compliable/util/field_params.rb +1 -0
- data/lib/jsonapi_compliable/util/hash.rb +18 -0
- data/lib/jsonapi_compliable/util/include_params.rb +22 -0
- data/lib/jsonapi_compliable/util/persistence.rb +13 -3
- data/lib/jsonapi_compliable/util/relationship_payload.rb +2 -0
- data/lib/jsonapi_compliable/util/render_options.rb +2 -0
- data/lib/jsonapi_compliable/util/validation_response.rb +16 -0
- data/lib/jsonapi_compliable/version.rb +1 -1
- metadata +60 -5
- data/gemfiles/rails_4.gemfile.lock +0 -208
- data/gemfiles/rails_5.gemfile.lock +0 -212
- data/lib/jsonapi_compliable/write.rb +0 -93
@@ -0,0 +1,228 @@
|
|
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
|
+
Class: JsonapiCompliable::Util::FieldParams
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.9
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "JsonapiCompliable::Util::FieldParams";
|
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 (F)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../JsonapiCompliable.html" title="JsonapiCompliable (module)">JsonapiCompliable</a></span></span> » <span class='title'><span class='object_link'><a href="../Util.html" title="JsonapiCompliable::Util (module)">Util</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">FieldParams</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>Class: JsonapiCompliable::Util::FieldParams
|
63
|
+
|
64
|
+
|
65
|
+
<span class="private note title">Private</span>
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">JsonapiCompliable::Util::FieldParams</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<dl>
|
96
|
+
<dt>Defined in:</dt>
|
97
|
+
<dd>lib/jsonapi_compliable/util/field_params.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
<p class="note private">
|
105
|
+
<strong>This class is part of a private API.</strong>
|
106
|
+
You should avoid using this class if possible, as it may be removed or be changed in the future.
|
107
|
+
</p>
|
108
|
+
|
109
|
+
|
110
|
+
</div>
|
111
|
+
</div>
|
112
|
+
<div class="tags">
|
113
|
+
|
114
|
+
|
115
|
+
</div>
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
<h2>
|
124
|
+
Class Method Summary
|
125
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
126
|
+
</h2>
|
127
|
+
|
128
|
+
<ul class="summary">
|
129
|
+
|
130
|
+
<li class="public ">
|
131
|
+
<span class="summary_signature">
|
132
|
+
|
133
|
+
<a href="#parse-class_method" title="parse (class method)">.<strong>parse</strong>(params) ⇒ Object </a>
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
</span>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
<span class="private note title">private</span>
|
145
|
+
|
146
|
+
|
147
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
148
|
+
|
149
|
+
</li>
|
150
|
+
|
151
|
+
|
152
|
+
</ul>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
<div id="class_method_details" class="method_details_list">
|
158
|
+
<h2>Class Method Details</h2>
|
159
|
+
|
160
|
+
|
161
|
+
<div class="method_details first">
|
162
|
+
<h3 class="signature first" id="parse-class_method">
|
163
|
+
|
164
|
+
.<strong>parse</strong>(params) ⇒ <tt>Object</tt>
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
</h3><div class="docstring">
|
171
|
+
<div class="discussion">
|
172
|
+
<p class="note private">
|
173
|
+
<strong>This method is part of a private API.</strong>
|
174
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
175
|
+
</p>
|
176
|
+
|
177
|
+
|
178
|
+
</div>
|
179
|
+
</div>
|
180
|
+
<div class="tags">
|
181
|
+
|
182
|
+
|
183
|
+
</div><table class="source_code">
|
184
|
+
<tr>
|
185
|
+
<td>
|
186
|
+
<pre class="lines">
|
187
|
+
|
188
|
+
|
189
|
+
5
|
190
|
+
6
|
191
|
+
7
|
192
|
+
8
|
193
|
+
9
|
194
|
+
10
|
195
|
+
11
|
196
|
+
12
|
197
|
+
13</pre>
|
198
|
+
</td>
|
199
|
+
<td>
|
200
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/util/field_params.rb', line 5</span>
|
201
|
+
|
202
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
|
203
|
+
<span class='kw'>return</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='kw'>if</span> <span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
204
|
+
|
205
|
+
<span class='lbrace'>{</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_tap'>tap</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_parsed'>parsed</span><span class='op'>|</span>
|
206
|
+
<span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</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>
|
207
|
+
<span class='id identifier rubyid_parsed'>parsed</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><span class='period'>.</span><span class='id identifier rubyid_split'>split</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><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:to_sym</span><span class='rparen'>)</span>
|
208
|
+
<span class='kw'>end</span>
|
209
|
+
<span class='kw'>end</span>
|
210
|
+
<span class='kw'>end</span></pre>
|
211
|
+
</td>
|
212
|
+
</tr>
|
213
|
+
</table>
|
214
|
+
</div>
|
215
|
+
|
216
|
+
</div>
|
217
|
+
|
218
|
+
</div>
|
219
|
+
|
220
|
+
<div id="footer">
|
221
|
+
Generated on Fri May 5 15:53:23 2017 by
|
222
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
223
|
+
0.9.9 (ruby-2.3.0).
|
224
|
+
</div>
|
225
|
+
|
226
|
+
</div>
|
227
|
+
</body>
|
228
|
+
</html>
|
@@ -0,0 +1,471 @@
|
|
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
|
+
Class: JsonapiCompliable::Util::Hash
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.9
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "JsonapiCompliable::Util::Hash";
|
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 (H)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../JsonapiCompliable.html" title="JsonapiCompliable (module)">JsonapiCompliable</a></span></span> » <span class='title'><span class='object_link'><a href="../Util.html" title="JsonapiCompliable::Util (module)">Util</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Hash</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>Class: JsonapiCompliable::Util::Hash
|
63
|
+
|
64
|
+
|
65
|
+
<span class="private note title">Private</span>
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">JsonapiCompliable::Util::Hash</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<dl>
|
96
|
+
<dt>Defined in:</dt>
|
97
|
+
<dd>lib/jsonapi_compliable/util/hash.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
<p class="note private">
|
105
|
+
<strong>This class is part of a private API.</strong>
|
106
|
+
You should avoid using this class if possible, as it may be removed or be changed in the future.
|
107
|
+
</p>
|
108
|
+
|
109
|
+
|
110
|
+
</div>
|
111
|
+
</div>
|
112
|
+
<div class="tags">
|
113
|
+
|
114
|
+
|
115
|
+
</div>
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
<h2>
|
124
|
+
Class Method Summary
|
125
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
126
|
+
</h2>
|
127
|
+
|
128
|
+
<ul class="summary">
|
129
|
+
|
130
|
+
<li class="public ">
|
131
|
+
<span class="summary_signature">
|
132
|
+
|
133
|
+
<a href="#deep_dup-class_method" title="deep_dup (class method)">.<strong>deep_dup</strong>(hash) ⇒ Object </a>
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
</span>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
<span class="private note title">private</span>
|
145
|
+
|
146
|
+
|
147
|
+
<span class="summary_desc"><div class='inline'>
|
148
|
+
<p>Like ActiveSupport's #deep_dup.</p>
|
149
|
+
</div></span>
|
150
|
+
|
151
|
+
</li>
|
152
|
+
|
153
|
+
|
154
|
+
<li class="public ">
|
155
|
+
<span class="summary_signature">
|
156
|
+
|
157
|
+
<a href="#deep_merge!-class_method" title="deep_merge! (class method)">.<strong>deep_merge!</strong>(hash, other) ⇒ Hash </a>
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
</span>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
<span class="private note title">private</span>
|
169
|
+
|
170
|
+
|
171
|
+
<span class="summary_desc"><div class='inline'>
|
172
|
+
<p>Like ActiveSupport's #deep_merge.</p>
|
173
|
+
</div></span>
|
174
|
+
|
175
|
+
</li>
|
176
|
+
|
177
|
+
|
178
|
+
<li class="public ">
|
179
|
+
<span class="summary_signature">
|
180
|
+
|
181
|
+
<a href="#keys-class_method" title="keys (class method)">.<strong>keys</strong>(hash, collection = []) ⇒ Array<Symbol, String> </a>
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
</span>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
<span class="private note title">private</span>
|
193
|
+
|
194
|
+
|
195
|
+
<span class="summary_desc"><div class='inline'>
|
196
|
+
<p>Grab all keys at any level of the hash.</p>
|
197
|
+
</div></span>
|
198
|
+
|
199
|
+
</li>
|
200
|
+
|
201
|
+
|
202
|
+
</ul>
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
<div id="class_method_details" class="method_details_list">
|
208
|
+
<h2>Class Method Details</h2>
|
209
|
+
|
210
|
+
|
211
|
+
<div class="method_details first">
|
212
|
+
<h3 class="signature first" id="deep_dup-class_method">
|
213
|
+
|
214
|
+
.<strong>deep_dup</strong>(hash) ⇒ <tt>Object</tt>
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
</h3><div class="docstring">
|
221
|
+
<div class="discussion">
|
222
|
+
<p class="note private">
|
223
|
+
<strong>This method is part of a private API.</strong>
|
224
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
225
|
+
</p>
|
226
|
+
|
227
|
+
<p>Like ActiveSupport's #deep_dup</p>
|
228
|
+
|
229
|
+
|
230
|
+
</div>
|
231
|
+
</div>
|
232
|
+
<div class="tags">
|
233
|
+
|
234
|
+
|
235
|
+
</div><table class="source_code">
|
236
|
+
<tr>
|
237
|
+
<td>
|
238
|
+
<pre class="lines">
|
239
|
+
|
240
|
+
|
241
|
+
36
|
242
|
+
37
|
243
|
+
38
|
244
|
+
39
|
245
|
+
40
|
246
|
+
41
|
247
|
+
42
|
248
|
+
43
|
249
|
+
44
|
250
|
+
45
|
251
|
+
46
|
252
|
+
47
|
253
|
+
48</pre>
|
254
|
+
</td>
|
255
|
+
<td>
|
256
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/util/hash.rb', line 36</span>
|
257
|
+
|
258
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_deep_dup'>deep_dup</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
259
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:deep_dup</span><span class='rparen'>)</span>
|
260
|
+
<span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_deep_dup'>deep_dup</span>
|
261
|
+
<span class='kw'>else</span>
|
262
|
+
<span class='lbrace'>{</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_tap'>tap</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_duped'>duped</span><span class='op'>|</span>
|
263
|
+
<span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</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>
|
264
|
+
<span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='id identifier rubyid_deep_dup'>deep_dup</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="" title="JsonapiCompliable::Util::Hash (class)">Hash</a></span></span><span class='rparen'>)</span>
|
265
|
+
<span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span> <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span> <span class='op'>&&</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:dup</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='op'>!</span><span class='lbracket'>[</span><span class='const'>Symbol</span><span class='comma'>,</span> <span class='const'>Fixnum</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rparen'>)</span>
|
266
|
+
<span class='id identifier rubyid_duped'>duped</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
267
|
+
<span class='kw'>end</span>
|
268
|
+
<span class='kw'>end</span>
|
269
|
+
<span class='kw'>end</span>
|
270
|
+
<span class='kw'>end</span></pre>
|
271
|
+
</td>
|
272
|
+
</tr>
|
273
|
+
</table>
|
274
|
+
</div>
|
275
|
+
|
276
|
+
<div class="method_details ">
|
277
|
+
<h3 class="signature " id="deep_merge!-class_method">
|
278
|
+
|
279
|
+
.<strong>deep_merge!</strong>(hash, other) ⇒ <tt><span class='object_link'><a href="" title="JsonapiCompliable::Util::Hash (class)">Hash</a></span></tt>
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
</h3><div class="docstring">
|
286
|
+
<div class="discussion">
|
287
|
+
<p class="note private">
|
288
|
+
<strong>This method is part of a private API.</strong>
|
289
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
290
|
+
</p>
|
291
|
+
|
292
|
+
<p>Like ActiveSupport's #deep_merge</p>
|
293
|
+
|
294
|
+
|
295
|
+
</div>
|
296
|
+
</div>
|
297
|
+
<div class="tags">
|
298
|
+
|
299
|
+
<p class="tag_title">Returns:</p>
|
300
|
+
<ul class="return">
|
301
|
+
|
302
|
+
<li>
|
303
|
+
|
304
|
+
|
305
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="JsonapiCompliable::Util::Hash (class)">Hash</a></span></tt>)</span>
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
—
|
310
|
+
<div class='inline'>
|
311
|
+
<p>the merged hash</p>
|
312
|
+
</div>
|
313
|
+
|
314
|
+
</li>
|
315
|
+
|
316
|
+
</ul>
|
317
|
+
|
318
|
+
</div><table class="source_code">
|
319
|
+
<tr>
|
320
|
+
<td>
|
321
|
+
<pre class="lines">
|
322
|
+
|
323
|
+
|
324
|
+
29
|
325
|
+
30
|
326
|
+
31
|
327
|
+
32</pre>
|
328
|
+
</td>
|
329
|
+
<td>
|
330
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/util/hash.rb', line 29</span>
|
331
|
+
|
332
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_deep_merge!'>deep_merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='comma'>,</span> <span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
|
333
|
+
<span class='id identifier rubyid_merger'>merger</span> <span class='op'>=</span> <span class='id identifier rubyid_proc'>proc</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_v1'>v1</span><span class='comma'>,</span> <span class='id identifier rubyid_v2'>v2</span><span class='op'>|</span> <span class='const'><span class='object_link'><a href="" title="JsonapiCompliable::Util::Hash (class)">Hash</a></span></span> <span class='op'>===</span> <span class='id identifier rubyid_v1'>v1</span> <span class='op'>&&</span> <span class='const'><span class='object_link'><a href="" title="JsonapiCompliable::Util::Hash (class)">Hash</a></span></span> <span class='op'>===</span> <span class='id identifier rubyid_v2'>v2</span> <span class='op'>?</span> <span class='id identifier rubyid_v1'>v1</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_v2'>v2</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_merger'>merger</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_v2'>v2</span> <span class='rbrace'>}</span>
|
334
|
+
<span class='id identifier rubyid_hash'>hash</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='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_merger'>merger</span><span class='rparen'>)</span>
|
335
|
+
<span class='kw'>end</span></pre>
|
336
|
+
</td>
|
337
|
+
</tr>
|
338
|
+
</table>
|
339
|
+
</div>
|
340
|
+
|
341
|
+
<div class="method_details ">
|
342
|
+
<h3 class="signature " id="keys-class_method">
|
343
|
+
|
344
|
+
.<strong>keys</strong>(hash, collection = []) ⇒ <tt>Array<Symbol, String></tt>
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
</h3><div class="docstring">
|
351
|
+
<div class="discussion">
|
352
|
+
<p class="note private">
|
353
|
+
<strong>This method is part of a private API.</strong>
|
354
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
355
|
+
</p>
|
356
|
+
|
357
|
+
<p>Grab all keys at any level of the hash.</p>
|
358
|
+
|
359
|
+
<pre class="code ruby"><code class="ruby"><span class='lbrace'>{</span> <span class='label'>foo:</span> <span class='lbrace'>{</span> <span class='label'>bar:</span> <span class='lbrace'>{</span> <span class='label'>baz:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span>
|
360
|
+
</code></pre>
|
361
|
+
|
362
|
+
<p>Becomes</p>
|
363
|
+
<dl class="rdoc-list label-list"><dt>:foo, :bar, :bar
|
364
|
+
<dd></dd></dl>
|
365
|
+
|
366
|
+
|
367
|
+
</div>
|
368
|
+
</div>
|
369
|
+
<div class="tags">
|
370
|
+
<p class="tag_title">Parameters:</p>
|
371
|
+
<ul class="param">
|
372
|
+
|
373
|
+
<li>
|
374
|
+
|
375
|
+
<span class='name'>hash</span>
|
376
|
+
|
377
|
+
|
378
|
+
<span class='type'></span>
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
—
|
383
|
+
<div class='inline'>
|
384
|
+
<p>the hash we want to process</p>
|
385
|
+
</div>
|
386
|
+
|
387
|
+
</li>
|
388
|
+
|
389
|
+
<li>
|
390
|
+
|
391
|
+
<span class='name'>collection</span>
|
392
|
+
|
393
|
+
|
394
|
+
<span class='type'>(<tt>Array<Symbol, String></tt>)</span>
|
395
|
+
|
396
|
+
|
397
|
+
<em class="default">(defaults to: <tt>[]</tt>)</em>
|
398
|
+
|
399
|
+
|
400
|
+
—
|
401
|
+
<div class='inline'>
|
402
|
+
<p>the memoized collection of keys</p>
|
403
|
+
</div>
|
404
|
+
|
405
|
+
</li>
|
406
|
+
|
407
|
+
</ul>
|
408
|
+
|
409
|
+
<p class="tag_title">Returns:</p>
|
410
|
+
<ul class="return">
|
411
|
+
|
412
|
+
<li>
|
413
|
+
|
414
|
+
|
415
|
+
<span class='type'>(<tt>Array<Symbol, String></tt>)</span>
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
—
|
420
|
+
<div class='inline'>
|
421
|
+
<p>the keys</p>
|
422
|
+
</div>
|
423
|
+
|
424
|
+
</li>
|
425
|
+
|
426
|
+
</ul>
|
427
|
+
|
428
|
+
</div><table class="source_code">
|
429
|
+
<tr>
|
430
|
+
<td>
|
431
|
+
<pre class="lines">
|
432
|
+
|
433
|
+
|
434
|
+
17
|
435
|
+
18
|
436
|
+
19
|
437
|
+
20
|
438
|
+
21
|
439
|
+
22
|
440
|
+
23
|
441
|
+
24</pre>
|
442
|
+
</td>
|
443
|
+
<td>
|
444
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/util/hash.rb', line 17</span>
|
445
|
+
|
446
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='comma'>,</span> <span class='id identifier rubyid_collection'>collection</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
447
|
+
<span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</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>
|
448
|
+
<span class='id identifier rubyid_collection'>collection</span> <span class='op'><<</span> <span class='id identifier rubyid_key'>key</span>
|
449
|
+
<span class='id identifier rubyid_keys'>keys</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_collection'>collection</span><span class='rparen'>)</span>
|
450
|
+
<span class='kw'>end</span>
|
451
|
+
|
452
|
+
<span class='id identifier rubyid_collection'>collection</span>
|
453
|
+
<span class='kw'>end</span></pre>
|
454
|
+
</td>
|
455
|
+
</tr>
|
456
|
+
</table>
|
457
|
+
</div>
|
458
|
+
|
459
|
+
</div>
|
460
|
+
|
461
|
+
</div>
|
462
|
+
|
463
|
+
<div id="footer">
|
464
|
+
Generated on Fri May 5 15:53:22 2017 by
|
465
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
466
|
+
0.9.9 (ruby-2.3.0).
|
467
|
+
</div>
|
468
|
+
|
469
|
+
</div>
|
470
|
+
</body>
|
471
|
+
</html>
|