ovto 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.gitmodules +3 -0
- data/CHANGELOG.md +22 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +57 -0
- data/LICENSE.txt +44 -0
- data/README.md +84 -0
- data/Rakefile +41 -0
- data/book/README.md +1 -0
- data/book/SUMMARY.md +13 -0
- data/book/api/actions.md +77 -0
- data/book/api/app.md +86 -0
- data/book/api/component.md +175 -0
- data/book/api/fetch.md +42 -0
- data/book/api/state.md +97 -0
- data/book/guides/debugging.md +23 -0
- data/book/guides/development.md +11 -0
- data/book/guides/tutorial.md +288 -0
- data/book/screenshot.png +0 -0
- data/docs/api/Ovto/Actions.html +135 -0
- data/docs/api/Ovto/App.html +531 -0
- data/docs/api/Ovto/Component/MoreThanOneNode.html +135 -0
- data/docs/api/Ovto/Component.html +350 -0
- data/docs/api/Ovto/Runtime.html +315 -0
- data/docs/api/Ovto/State/MissingValue.html +135 -0
- data/docs/api/Ovto/State/UnknownKey.html +135 -0
- data/docs/api/Ovto/State.html +699 -0
- data/docs/api/Ovto/WiredActions.html +343 -0
- data/docs/api/Ovto.html +319 -0
- data/docs/api/_index.html +229 -0
- data/docs/api/actions.html +398 -0
- data/docs/api/app.html +411 -0
- data/docs/api/class_list.html +51 -0
- data/docs/api/component.html +469 -0
- data/docs/api/css/common.css +1 -0
- data/docs/api/css/full_list.css +58 -0
- data/docs/api/css/style.css +499 -0
- data/docs/api/file.README.html +162 -0
- data/docs/api/file_list.html +56 -0
- data/docs/api/frames.html +17 -0
- data/docs/api/index.html +162 -0
- data/docs/api/js/app.js +248 -0
- data/docs/api/js/full_list.js +216 -0
- data/docs/api/js/jquery.js +4 -0
- data/docs/api/method_list.html +243 -0
- data/docs/api/state.html +430 -0
- data/docs/api/top-level-namespace.html +110 -0
- data/docs/gitbook/fonts/fontawesome/FontAwesome.otf +0 -0
- data/docs/gitbook/fonts/fontawesome/fontawesome-webfont.eot +0 -0
- data/docs/gitbook/fonts/fontawesome/fontawesome-webfont.svg +685 -0
- data/docs/gitbook/fonts/fontawesome/fontawesome-webfont.ttf +0 -0
- data/docs/gitbook/fonts/fontawesome/fontawesome-webfont.woff +0 -0
- data/docs/gitbook/fonts/fontawesome/fontawesome-webfont.woff2 +0 -0
- data/docs/gitbook/gitbook-plugin-fontsettings/fontsettings.js +240 -0
- data/docs/gitbook/gitbook-plugin-fontsettings/website.css +291 -0
- data/docs/gitbook/gitbook-plugin-highlight/ebook.css +135 -0
- data/docs/gitbook/gitbook-plugin-highlight/website.css +434 -0
- data/docs/gitbook/gitbook-plugin-lunr/lunr.min.js +7 -0
- data/docs/gitbook/gitbook-plugin-lunr/search-lunr.js +59 -0
- data/docs/gitbook/gitbook-plugin-search/lunr.min.js +7 -0
- data/docs/gitbook/gitbook-plugin-search/search-engine.js +50 -0
- data/docs/gitbook/gitbook-plugin-search/search.css +35 -0
- data/docs/gitbook/gitbook-plugin-search/search.js +213 -0
- data/docs/gitbook/gitbook-plugin-sharing/buttons.js +90 -0
- data/docs/gitbook/gitbook.js +4 -0
- data/docs/gitbook/images/apple-touch-icon-precomposed-152.png +0 -0
- data/docs/gitbook/images/favicon.ico +0 -0
- data/docs/gitbook/style.css +9 -0
- data/docs/gitbook/theme.js +4 -0
- data/docs/guides/debugging.html +355 -0
- data/docs/guides/development.html +361 -0
- data/docs/guides/tutorial.html +571 -0
- data/docs/index.html +422 -0
- data/docs/screenshot.png +0 -0
- data/docs/search_index.json +1 -0
- data/example/sinatra/Gemfile +6 -0
- data/example/sinatra/Gemfile.lock +59 -0
- data/example/sinatra/README.md +21 -0
- data/example/sinatra/app.rb +18 -0
- data/example/sinatra/config.ru +30 -0
- data/example/sinatra/ovto/app.rb +171 -0
- data/example/sinatra/public/style.css +4 -0
- data/example/sinatra/public/todomvc-app-css_index.css +376 -0
- data/example/sinatra/public/todomvc-common_base.css +141 -0
- data/example/sinatra/views/index.erb +21 -0
- data/example/static/Gemfile +3 -0
- data/example/static/Gemfile.lock +30 -0
- data/example/static/README.md +10 -0
- data/example/static/Rakefile +4 -0
- data/example/static/app.js +24808 -0
- data/example/static/app.rb +43 -0
- data/example/static/index.html +11 -0
- data/lib/ovto/actions.rb +10 -0
- data/lib/ovto/app.rb +58 -0
- data/lib/ovto/component.rb +191 -0
- data/lib/ovto/fetch.rb +53 -0
- data/lib/ovto/runtime.rb +388 -0
- data/lib/ovto/state.rb +69 -0
- data/lib/ovto/version.rb +3 -0
- data/lib/ovto/wired_actions.rb +33 -0
- data/lib/ovto.rb +50 -0
- data/ovto.gemspec +22 -0
- data/screenshot.png +0 -0
- metadata +161 -0
@@ -0,0 +1,699 @@
|
|
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: Ovto::State
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.12
|
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 = "Ovto::State";
|
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 (S)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../Ovto.html" title="Ovto (module)">Ovto</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">State</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: Ovto::State
|
63
|
+
|
64
|
+
|
65
|
+
|
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">Ovto::State</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/ovto/state.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<h2>Defined Under Namespace</h2>
|
103
|
+
<p class="children">
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="State/MissingValue.html" title="Ovto::State::MissingValue (class)">MissingValue</a></span>, <span class='object_link'><a href="State/UnknownKey.html" title="Ovto::State::UnknownKey (class)">UnknownKey</a></span>
|
109
|
+
|
110
|
+
|
111
|
+
</p>
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
<h2>
|
121
|
+
Class Method Summary
|
122
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
123
|
+
</h2>
|
124
|
+
|
125
|
+
<ul class="summary">
|
126
|
+
|
127
|
+
<li class="public ">
|
128
|
+
<span class="summary_signature">
|
129
|
+
|
130
|
+
<a href="#inherited-class_method" title="inherited (class method)">.<strong>inherited</strong>(subclass) ⇒ Object </a>
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
</span>
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
<span class="summary_desc"><div class='inline'>
|
145
|
+
<p>(internal) initialize subclass.</p>
|
146
|
+
</div></span>
|
147
|
+
|
148
|
+
</li>
|
149
|
+
|
150
|
+
|
151
|
+
<li class="public ">
|
152
|
+
<span class="summary_signature">
|
153
|
+
|
154
|
+
<a href="#item-class_method" title="item (class method)">.<strong>item</strong>(name, options = {}) ⇒ Object </a>
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
</span>
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
<span class="summary_desc"><div class='inline'>
|
169
|
+
<p>Declare state item.</p>
|
170
|
+
</div></span>
|
171
|
+
|
172
|
+
</li>
|
173
|
+
|
174
|
+
|
175
|
+
<li class="public ">
|
176
|
+
<span class="summary_signature">
|
177
|
+
|
178
|
+
<a href="#item_specs-class_method" title="item_specs (class method)">.<strong>item_specs</strong> ⇒ Object </a>
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
</span>
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
<span class="summary_desc"><div class='inline'>
|
193
|
+
<p>Return list of item specs (Array of `[name, options]`).</p>
|
194
|
+
</div></span>
|
195
|
+
|
196
|
+
</li>
|
197
|
+
|
198
|
+
|
199
|
+
</ul>
|
200
|
+
|
201
|
+
<h2>
|
202
|
+
Instance Method Summary
|
203
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
204
|
+
</h2>
|
205
|
+
|
206
|
+
<ul class="summary">
|
207
|
+
|
208
|
+
<li class="public ">
|
209
|
+
<span class="summary_signature">
|
210
|
+
|
211
|
+
<a href="#[]-instance_method" title="#[] (instance method)">#<strong>[]</strong>(key) ⇒ Object </a>
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
</span>
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
<span class="summary_desc"><div class='inline'>
|
226
|
+
<p>Return the value corresponds to `key`.</p>
|
227
|
+
</div></span>
|
228
|
+
|
229
|
+
</li>
|
230
|
+
|
231
|
+
|
232
|
+
<li class="public ">
|
233
|
+
<span class="summary_signature">
|
234
|
+
|
235
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(hash = {}) ⇒ State </a>
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
</span>
|
240
|
+
|
241
|
+
|
242
|
+
<span class="note title constructor">constructor</span>
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
<span class="summary_desc"><div class='inline'>
|
252
|
+
<p>A new instance of State.</p>
|
253
|
+
</div></span>
|
254
|
+
|
255
|
+
</li>
|
256
|
+
|
257
|
+
|
258
|
+
<li class="public ">
|
259
|
+
<span class="summary_signature">
|
260
|
+
|
261
|
+
<a href="#inspect-instance_method" title="#inspect (instance method)">#<strong>inspect</strong> ⇒ Object </a>
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
</span>
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
276
|
+
|
277
|
+
</li>
|
278
|
+
|
279
|
+
|
280
|
+
<li class="public ">
|
281
|
+
<span class="summary_signature">
|
282
|
+
|
283
|
+
<a href="#merge-instance_method" title="#merge (instance method)">#<strong>merge</strong>(hash) ⇒ Object </a>
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
</span>
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
<span class="summary_desc"><div class='inline'>
|
298
|
+
<p>Create new state object from `self` and `hash`.</p>
|
299
|
+
</div></span>
|
300
|
+
|
301
|
+
</li>
|
302
|
+
|
303
|
+
|
304
|
+
<li class="public ">
|
305
|
+
<span class="summary_signature">
|
306
|
+
|
307
|
+
<a href="#to_h-instance_method" title="#to_h (instance method)">#<strong>to_h</strong> ⇒ Object </a>
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
</span>
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
322
|
+
|
323
|
+
</li>
|
324
|
+
|
325
|
+
|
326
|
+
</ul>
|
327
|
+
|
328
|
+
|
329
|
+
<div id="constructor_details" class="method_details_list">
|
330
|
+
<h2>Constructor Details</h2>
|
331
|
+
|
332
|
+
<div class="method_details first">
|
333
|
+
<h3 class="signature first" id="initialize-instance_method">
|
334
|
+
|
335
|
+
#<strong>initialize</strong>(hash = {}) ⇒ <tt><span class='object_link'><a href="" title="Ovto::State (class)">State</a></span></tt>
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
</h3><div class="docstring">
|
342
|
+
<div class="discussion">
|
343
|
+
|
344
|
+
<p>Returns a new instance of State</p>
|
345
|
+
|
346
|
+
|
347
|
+
</div>
|
348
|
+
</div>
|
349
|
+
<div class="tags">
|
350
|
+
|
351
|
+
|
352
|
+
</div><table class="source_code">
|
353
|
+
<tr>
|
354
|
+
<td>
|
355
|
+
<pre class="lines">
|
356
|
+
|
357
|
+
|
358
|
+
25
|
359
|
+
26
|
360
|
+
27
|
361
|
+
28
|
362
|
+
29
|
363
|
+
30
|
364
|
+
31
|
365
|
+
32
|
366
|
+
33
|
367
|
+
34
|
368
|
+
35
|
369
|
+
36
|
370
|
+
37
|
371
|
+
38
|
372
|
+
39</pre>
|
373
|
+
</td>
|
374
|
+
<td>
|
375
|
+
<pre class="code"><span class="info file"># File 'lib/ovto/state.rb', line 25</span>
|
376
|
+
|
377
|
+
<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>
|
378
|
+
<span class='id identifier rubyid_unknown_keys'>unknown_keys</span> <span class='op'>=</span> <span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</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_item_specs'>item_specs</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:first</span><span class='rparen'>)</span>
|
379
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_unknown_keys'>unknown_keys</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span>
|
380
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="State/UnknownKey.html" title="Ovto::State::UnknownKey (class)">UnknownKey</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>unknown key(s): </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_unknown_keys'>unknown_keys</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
381
|
+
<span class='kw'>end</span>
|
382
|
+
|
383
|
+
<span class='ivar'>@values</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_item_specs'>item_specs</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='op'>|</span>
|
384
|
+
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='op'>!</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='symbol'>:default</span><span class='rparen'>)</span>
|
385
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="State/MissingValue.html" title="Ovto::State::MissingValue (class)">MissingValue</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'> is mandatory for </span><span class='embexpr_beg'>#{</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_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'>.new</span><span class='tstring_end'>"</span></span>
|
386
|
+
<span class='kw'>end</span>
|
387
|
+
<span class='comment'># Note that `hash[key]` may be false or nil
|
388
|
+
</span> <span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:default</span><span class='rbracket'>]</span>
|
389
|
+
<span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rbracket'>]</span>
|
390
|
+
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_to_h'>to_h</span>
|
391
|
+
<span class='kw'>end</span></pre>
|
392
|
+
</td>
|
393
|
+
</tr>
|
394
|
+
</table>
|
395
|
+
</div>
|
396
|
+
|
397
|
+
</div>
|
398
|
+
|
399
|
+
|
400
|
+
<div id="class_method_details" class="method_details_list">
|
401
|
+
<h2>Class Method Details</h2>
|
402
|
+
|
403
|
+
|
404
|
+
<div class="method_details first">
|
405
|
+
<h3 class="signature first" id="inherited-class_method">
|
406
|
+
|
407
|
+
.<strong>inherited</strong>(subclass) ⇒ <tt>Object</tt>
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
</h3><div class="docstring">
|
414
|
+
<div class="discussion">
|
415
|
+
|
416
|
+
<p>(internal) initialize subclass</p>
|
417
|
+
|
418
|
+
|
419
|
+
</div>
|
420
|
+
</div>
|
421
|
+
<div class="tags">
|
422
|
+
|
423
|
+
|
424
|
+
</div><table class="source_code">
|
425
|
+
<tr>
|
426
|
+
<td>
|
427
|
+
<pre class="lines">
|
428
|
+
|
429
|
+
|
430
|
+
9
|
431
|
+
10
|
432
|
+
11</pre>
|
433
|
+
</td>
|
434
|
+
<td>
|
435
|
+
<pre class="code"><span class="info file"># File 'lib/ovto/state.rb', line 9</span>
|
436
|
+
|
437
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_inherited'>inherited</span><span class='lparen'>(</span><span class='id identifier rubyid_subclass'>subclass</span><span class='rparen'>)</span>
|
438
|
+
<span class='id identifier rubyid_subclass'>subclass</span><span class='period'>.</span><span class='id identifier rubyid_instance_variable_set'>instance_variable_set</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>@item_specs</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
439
|
+
<span class='kw'>end</span></pre>
|
440
|
+
</td>
|
441
|
+
</tr>
|
442
|
+
</table>
|
443
|
+
</div>
|
444
|
+
|
445
|
+
<div class="method_details ">
|
446
|
+
<h3 class="signature " id="item-class_method">
|
447
|
+
|
448
|
+
.<strong>item</strong>(name, options = {}) ⇒ <tt>Object</tt>
|
449
|
+
|
450
|
+
|
451
|
+
|
452
|
+
|
453
|
+
|
454
|
+
</h3><div class="docstring">
|
455
|
+
<div class="discussion">
|
456
|
+
|
457
|
+
<p>Declare state item</p>
|
458
|
+
|
459
|
+
|
460
|
+
</div>
|
461
|
+
</div>
|
462
|
+
<div class="tags">
|
463
|
+
|
464
|
+
|
465
|
+
</div><table class="source_code">
|
466
|
+
<tr>
|
467
|
+
<td>
|
468
|
+
<pre class="lines">
|
469
|
+
|
470
|
+
|
471
|
+
14
|
472
|
+
15
|
473
|
+
16
|
474
|
+
17
|
475
|
+
18</pre>
|
476
|
+
</td>
|
477
|
+
<td>
|
478
|
+
<pre class="code"><span class="info file"># File 'lib/ovto/state.rb', line 14</span>
|
479
|
+
|
480
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_item'>item</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
481
|
+
<span class='ivar'>@item_specs</span> <span class='op'><<</span> <span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rbracket'>]</span>
|
482
|
+
<span class='comment'># Define accessor
|
483
|
+
</span> <span class='id identifier rubyid_define_method'>define_method</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='lbrace'>{</span> <span class='ivar'>@values</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span> <span class='rbrace'>}</span>
|
484
|
+
<span class='kw'>end</span></pre>
|
485
|
+
</td>
|
486
|
+
</tr>
|
487
|
+
</table>
|
488
|
+
</div>
|
489
|
+
|
490
|
+
<div class="method_details ">
|
491
|
+
<h3 class="signature " id="item_specs-class_method">
|
492
|
+
|
493
|
+
.<strong>item_specs</strong> ⇒ <tt>Object</tt>
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
|
498
|
+
|
499
|
+
</h3><div class="docstring">
|
500
|
+
<div class="discussion">
|
501
|
+
|
502
|
+
<p>Return list of item specs (Array of `[name, options]`)</p>
|
503
|
+
|
504
|
+
|
505
|
+
</div>
|
506
|
+
</div>
|
507
|
+
<div class="tags">
|
508
|
+
|
509
|
+
|
510
|
+
</div><table class="source_code">
|
511
|
+
<tr>
|
512
|
+
<td>
|
513
|
+
<pre class="lines">
|
514
|
+
|
515
|
+
|
516
|
+
21
|
517
|
+
22
|
518
|
+
23</pre>
|
519
|
+
</td>
|
520
|
+
<td>
|
521
|
+
<pre class="code"><span class="info file"># File 'lib/ovto/state.rb', line 21</span>
|
522
|
+
|
523
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_item_specs'>item_specs</span>
|
524
|
+
<span class='ivar'>@item_specs</span>
|
525
|
+
<span class='kw'>end</span></pre>
|
526
|
+
</td>
|
527
|
+
</tr>
|
528
|
+
</table>
|
529
|
+
</div>
|
530
|
+
|
531
|
+
</div>
|
532
|
+
|
533
|
+
<div id="instance_method_details" class="method_details_list">
|
534
|
+
<h2>Instance Method Details</h2>
|
535
|
+
|
536
|
+
|
537
|
+
<div class="method_details first">
|
538
|
+
<h3 class="signature first" id="[]-instance_method">
|
539
|
+
|
540
|
+
#<strong>[]</strong>(key) ⇒ <tt>Object</tt>
|
541
|
+
|
542
|
+
|
543
|
+
|
544
|
+
|
545
|
+
|
546
|
+
</h3><div class="docstring">
|
547
|
+
<div class="discussion">
|
548
|
+
|
549
|
+
<p>Return the value corresponds to `key`</p>
|
550
|
+
|
551
|
+
|
552
|
+
</div>
|
553
|
+
</div>
|
554
|
+
<div class="tags">
|
555
|
+
|
556
|
+
|
557
|
+
</div><table class="source_code">
|
558
|
+
<tr>
|
559
|
+
<td>
|
560
|
+
<pre class="lines">
|
561
|
+
|
562
|
+
|
563
|
+
51
|
564
|
+
52
|
565
|
+
53</pre>
|
566
|
+
</td>
|
567
|
+
<td>
|
568
|
+
<pre class="code"><span class="info file"># File 'lib/ovto/state.rb', line 51</span>
|
569
|
+
|
570
|
+
<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>
|
571
|
+
<span class='ivar'>@values</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span>
|
572
|
+
<span class='kw'>end</span></pre>
|
573
|
+
</td>
|
574
|
+
</tr>
|
575
|
+
</table>
|
576
|
+
</div>
|
577
|
+
|
578
|
+
<div class="method_details ">
|
579
|
+
<h3 class="signature " id="inspect-instance_method">
|
580
|
+
|
581
|
+
#<strong>inspect</strong> ⇒ <tt>Object</tt>
|
582
|
+
|
583
|
+
|
584
|
+
|
585
|
+
|
586
|
+
|
587
|
+
</h3><table class="source_code">
|
588
|
+
<tr>
|
589
|
+
<td>
|
590
|
+
<pre class="lines">
|
591
|
+
|
592
|
+
|
593
|
+
59
|
594
|
+
60
|
595
|
+
61</pre>
|
596
|
+
</td>
|
597
|
+
<td>
|
598
|
+
<pre class="code"><span class="info file"># File 'lib/ovto/state.rb', line 59</span>
|
599
|
+
|
600
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_inspect'>inspect</span>
|
601
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>#<</span><span class='embexpr_beg'>#{</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_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'>:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_object_id'>object_id</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='ivar'>@values</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>></span><span class='tstring_end'>"</span></span>
|
602
|
+
<span class='kw'>end</span></pre>
|
603
|
+
</td>
|
604
|
+
</tr>
|
605
|
+
</table>
|
606
|
+
</div>
|
607
|
+
|
608
|
+
<div class="method_details ">
|
609
|
+
<h3 class="signature " id="merge-instance_method">
|
610
|
+
|
611
|
+
#<strong>merge</strong>(hash) ⇒ <tt>Object</tt>
|
612
|
+
|
613
|
+
|
614
|
+
|
615
|
+
|
616
|
+
|
617
|
+
</h3><div class="docstring">
|
618
|
+
<div class="discussion">
|
619
|
+
|
620
|
+
<p>Create new state object from `self` and `hash`</p>
|
621
|
+
|
622
|
+
|
623
|
+
</div>
|
624
|
+
</div>
|
625
|
+
<div class="tags">
|
626
|
+
|
627
|
+
|
628
|
+
</div><table class="source_code">
|
629
|
+
<tr>
|
630
|
+
<td>
|
631
|
+
<pre class="lines">
|
632
|
+
|
633
|
+
|
634
|
+
42
|
635
|
+
43
|
636
|
+
44
|
637
|
+
45
|
638
|
+
46
|
639
|
+
47
|
640
|
+
48</pre>
|
641
|
+
</td>
|
642
|
+
<td>
|
643
|
+
<pre class="code"><span class="info file"># File 'lib/ovto/state.rb', line 42</span>
|
644
|
+
|
645
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
646
|
+
<span class='id identifier rubyid_unknown_keys'>unknown_keys</span> <span class='op'>=</span> <span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</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_item_specs'>item_specs</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:first</span><span class='rparen'>)</span>
|
647
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_unknown_keys'>unknown_keys</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span>
|
648
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="State/UnknownKey.html" title="Ovto::State::UnknownKey (class)">UnknownKey</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>unknown key(s): </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_unknown_keys'>unknown_keys</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
649
|
+
<span class='kw'>end</span>
|
650
|
+
<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='ivar'>@values</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
651
|
+
<span class='kw'>end</span></pre>
|
652
|
+
</td>
|
653
|
+
</tr>
|
654
|
+
</table>
|
655
|
+
</div>
|
656
|
+
|
657
|
+
<div class="method_details ">
|
658
|
+
<h3 class="signature " id="to_h-instance_method">
|
659
|
+
|
660
|
+
#<strong>to_h</strong> ⇒ <tt>Object</tt>
|
661
|
+
|
662
|
+
|
663
|
+
|
664
|
+
|
665
|
+
|
666
|
+
</h3><table class="source_code">
|
667
|
+
<tr>
|
668
|
+
<td>
|
669
|
+
<pre class="lines">
|
670
|
+
|
671
|
+
|
672
|
+
55
|
673
|
+
56
|
674
|
+
57</pre>
|
675
|
+
</td>
|
676
|
+
<td>
|
677
|
+
<pre class="code"><span class="info file"># File 'lib/ovto/state.rb', line 55</span>
|
678
|
+
|
679
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_h'>to_h</span>
|
680
|
+
<span class='ivar'>@values</span>
|
681
|
+
<span class='kw'>end</span></pre>
|
682
|
+
</td>
|
683
|
+
</tr>
|
684
|
+
</table>
|
685
|
+
</div>
|
686
|
+
|
687
|
+
</div>
|
688
|
+
|
689
|
+
</div>
|
690
|
+
|
691
|
+
<div id="footer">
|
692
|
+
Generated on Fri Jun 1 21:07:20 2018 by
|
693
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
694
|
+
0.9.12 (ruby-2.4.2).
|
695
|
+
</div>
|
696
|
+
|
697
|
+
</div>
|
698
|
+
</body>
|
699
|
+
</html>
|