the-swarm 1.0.3
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 +7 -0
- data/.gitignore +3 -0
- data/.yardopts +8 -0
- data/Gemfile +24 -0
- data/LICENSE.txt +22 -0
- data/README.md +35 -0
- data/Rakefile +26 -0
- data/bin/swarm +11 -0
- data/docs/Swarm.html +296 -0
- data/docs/Swarm/Catalog.html +819 -0
- data/docs/Swarm/Console.html +1050 -0
- data/docs/Swarm/Console/Color.html +160 -0
- data/docs/Swarm/Console/NormalKey.html +410 -0
- data/docs/Swarm/Console/PopUp.html +236 -0
- data/docs/Swarm/Console/VIKey.html +410 -0
- data/docs/Swarm/Five.html +421 -0
- data/docs/Swarm/Four.html +389 -0
- data/docs/Swarm/Game.html +1197 -0
- data/docs/Swarm/Intro.html +419 -0
- data/docs/Swarm/Level.html +700 -0
- data/docs/Swarm/Map.html +2336 -0
- data/docs/Swarm/One.html +353 -0
- data/docs/Swarm/Three.html +383 -0
- data/docs/Swarm/Tile.html +3823 -0
- data/docs/Swarm/Two.html +355 -0
- data/docs/_index.html +313 -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.LICENSE.html +70 -0
- data/docs/file.README.html +101 -0
- data/docs/file_list.html +61 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +101 -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 +1195 -0
- data/docs/top-level-namespace.html +110 -0
- data/lib/swarm.rb +60 -0
- data/lib/swarm/catalog.rb +71 -0
- data/lib/swarm/console.rb +165 -0
- data/lib/swarm/game.rb +173 -0
- data/lib/swarm/level.rb +58 -0
- data/lib/swarm/levels/five.rb +71 -0
- data/lib/swarm/levels/four.rb +55 -0
- data/lib/swarm/levels/intro.rb +36 -0
- data/lib/swarm/levels/one.rb +35 -0
- data/lib/swarm/levels/three.rb +51 -0
- data/lib/swarm/levels/two.rb +38 -0
- data/lib/swarm/map.rb +254 -0
- data/lib/swarm/tile.rb +149 -0
- data/lib/swarm/version.rb +5 -0
- data/swarm.gemspec +24 -0
- metadata +112 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ea179b6113926e3a0e79eedac2583a62bbbea7b7
|
4
|
+
data.tar.gz: 6232e055e33a48004b91cdaa8284f26d321f0817
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a7c777ee04becbf6b498479e7330a551211a4030f7d77ae434980359c8edcb3ccace41f10216865e62ef461056294b265329c15ebef1d0eb221544e704616f0b
|
7
|
+
data.tar.gz: 785b8504af8cccf055792e1967eab82803d2829406ca1dce0f1725e7800d54a9699e8b126fb71e0c7546fedb71169f48abffd7fee7b8f25e24aa2a7576ebf66e
|
data/.gitignore
ADDED
data/.yardopts
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'curses'
|
4
|
+
|
5
|
+
group :development do
|
6
|
+
gem 'rake'
|
7
|
+
gem 'yard'
|
8
|
+
gem 'minitest'
|
9
|
+
gem 'minitest-reporters'
|
10
|
+
gem 'minitest-utils'
|
11
|
+
gem 'minitest-gcstats'
|
12
|
+
|
13
|
+
gem 'awesome_print'
|
14
|
+
|
15
|
+
gem 'ruby-prof'
|
16
|
+
|
17
|
+
gem 'pry'
|
18
|
+
gem 'pry-rescue'
|
19
|
+
gem 'pry-docmore'
|
20
|
+
gem 'pry-doc'
|
21
|
+
end
|
22
|
+
|
23
|
+
gemspec
|
24
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright ©2017 Gino Lucero
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21
|
+
DEALINGS IN THE SOFTWARE.
|
22
|
+
LICENSE
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# swarm
|
2
|
+
|
3
|
+
### requirements
|
4
|
+
|
5
|
+
`Ruby 2+`
|
6
|
+
|
7
|
+
### description
|
8
|
+
|
9
|
+
Squish or be squished!
|
10
|
+
|
11
|
+
### quick installation
|
12
|
+
|
13
|
+
```
|
14
|
+
wget https://github.com/glucero/swarm/releases/download/1.0.3/swarm-1.0.3.gem
|
15
|
+
gem install swarm-1.0.3.gem
|
16
|
+
```
|
17
|
+
|
18
|
+
### usage
|
19
|
+
|
20
|
+
`swarm` or `SWARM=easy swarm`
|
21
|
+
|
22
|
+
### building and installing from source
|
23
|
+
|
24
|
+
```
|
25
|
+
git clone https://github.com/glucero/swarm
|
26
|
+
cd swarm
|
27
|
+
bundle
|
28
|
+
gem build swarm.gemspec
|
29
|
+
gem install swarm-VERSION.gem
|
30
|
+
```
|
31
|
+
|
32
|
+
### documentation
|
33
|
+
|
34
|
+
https://glucero.github.io/swarm/
|
35
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
desc 'List all rake tasks (rake -T)'
|
2
|
+
task(:default) do
|
3
|
+
Rake.application.options.show_tasks = :tasks
|
4
|
+
Rake.application.options.show_task_pattern = //
|
5
|
+
Rake.application.display_tasks_and_comments
|
6
|
+
end
|
7
|
+
|
8
|
+
Rake::TaskManager.record_task_metadata = true
|
9
|
+
|
10
|
+
require 'bundler/gem_tasks'
|
11
|
+
# require 'rake/testtask'
|
12
|
+
|
13
|
+
include Rake::DSL
|
14
|
+
|
15
|
+
desc 'Start Swarm'
|
16
|
+
task(:start) { exec File.join(__dir__, 'bin/swarm') }
|
17
|
+
|
18
|
+
desc 'Build Swarm Documentation'
|
19
|
+
task(:doc) { exec 'yard; ruby -run -ehttpd doc -p8080' }
|
20
|
+
|
21
|
+
# Rake::TestTask.new do |t|
|
22
|
+
# t.libs << 'test'
|
23
|
+
# t.test_files = FileList['test/*_test.rb']
|
24
|
+
# t.verbose = true
|
25
|
+
# end
|
26
|
+
|
data/bin/swarm
ADDED
data/docs/Swarm.html
ADDED
@@ -0,0 +1,296 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Module: Swarm
|
8
|
+
|
9
|
+
— "Swarm" Source Code Documentation
|
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 = "Swarm";
|
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
|
+
|
41
|
+
|
42
|
+
<span class="title">Swarm</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Module: Swarm
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<dl>
|
80
|
+
<dt>Defined in:</dt>
|
81
|
+
<dd>lib/swarm.rb<span class="defines">,<br />
|
82
|
+
lib/swarm/map.rb,<br /> lib/swarm/game.rb,<br /> lib/swarm/tile.rb,<br /> lib/swarm/level.rb,<br /> lib/swarm/catalog.rb,<br /> lib/swarm/console.rb,<br /> lib/swarm/version.rb,<br /> lib/swarm/levels/one.rb,<br /> lib/swarm/levels/two.rb,<br /> lib/swarm/levels/five.rb,<br /> lib/swarm/levels/four.rb,<br /> lib/swarm/levels/intro.rb,<br /> lib/swarm/levels/three.rb,<br /> lib/swarm/levels/example.rb</span>
|
83
|
+
</dd>
|
84
|
+
</dl>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
<h2>Overview</h2><div class="docstring">
|
89
|
+
<div class="discussion">
|
90
|
+
|
91
|
+
<p>Namespace for classes and modules of the <code>Swarm</code> application.</p>
|
92
|
+
|
93
|
+
|
94
|
+
</div>
|
95
|
+
</div>
|
96
|
+
<div class="tags">
|
97
|
+
|
98
|
+
|
99
|
+
</div><h2>Defined Under Namespace</h2>
|
100
|
+
<p class="children">
|
101
|
+
|
102
|
+
|
103
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Swarm/Console.html" title="Swarm::Console (module)">Console</a></span>
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Swarm/Catalog.html" title="Swarm::Catalog (class)">Catalog</a></span>, <span class='object_link'><a href="Swarm/Five.html" title="Swarm::Five (class)">Five</a></span>, <span class='object_link'><a href="Swarm/Four.html" title="Swarm::Four (class)">Four</a></span>, <span class='object_link'><a href="Swarm/Game.html" title="Swarm::Game (class)">Game</a></span>, <span class='object_link'><a href="Swarm/Intro.html" title="Swarm::Intro (class)">Intro</a></span>, <span class='object_link'><a href="Swarm/Level.html" title="Swarm::Level (class)">Level</a></span>, <span class='object_link'><a href="Swarm/Map.html" title="Swarm::Map (class)">Map</a></span>, <span class='object_link'><a href="Swarm/One.html" title="Swarm::One (class)">One</a></span>, <span class='object_link'><a href="Swarm/Three.html" title="Swarm::Three (class)">Three</a></span>, <span class='object_link'><a href="Swarm/Tile.html" title="Swarm::Tile (class)">Tile</a></span>, <span class='object_link'><a href="Swarm/Two.html" title="Swarm::Two (class)">Two</a></span>
|
108
|
+
|
109
|
+
|
110
|
+
</p>
|
111
|
+
|
112
|
+
<h2>Constant Summary</h2>
|
113
|
+
<dl class="constants">
|
114
|
+
|
115
|
+
<dt id="VERSION-constant" class="">VERSION =
|
116
|
+
|
117
|
+
</dt>
|
118
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>1.0.3</span><span class='tstring_end'>'</span></span></pre></dd>
|
119
|
+
|
120
|
+
</dl>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
<h2>
|
130
|
+
Class Method Summary
|
131
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
132
|
+
</h2>
|
133
|
+
|
134
|
+
<ul class="summary">
|
135
|
+
|
136
|
+
<li class="public ">
|
137
|
+
<span class="summary_signature">
|
138
|
+
|
139
|
+
<a href="#start-class_method" title="start (class method)">.<strong>start</strong> ⇒ Kernel#exit </a>
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
</span>
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
<span class="summary_desc"><div class='inline'>
|
154
|
+
<p>Initialize the console, launch the game, play the game, print the
|
155
|
+
scoreboard and exit to the shell.</p>
|
156
|
+
</div></span>
|
157
|
+
|
158
|
+
</li>
|
159
|
+
|
160
|
+
|
161
|
+
</ul>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
<div id="class_method_details" class="method_details_list">
|
167
|
+
<h2>Class Method Details</h2>
|
168
|
+
|
169
|
+
|
170
|
+
<div class="method_details first">
|
171
|
+
<h3 class="signature first" id="start-class_method">
|
172
|
+
|
173
|
+
.<strong>start</strong> ⇒ <tt>Kernel#exit</tt>
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
</h3><div class="docstring">
|
180
|
+
<div class="discussion">
|
181
|
+
|
182
|
+
<p>Initialize the console, launch the game, play the game, print the
|
183
|
+
scoreboard and exit to the shell.</p>
|
184
|
+
|
185
|
+
|
186
|
+
</div>
|
187
|
+
</div>
|
188
|
+
<div class="tags">
|
189
|
+
|
190
|
+
<p class="tag_title">Returns:</p>
|
191
|
+
<ul class="return">
|
192
|
+
|
193
|
+
<li>
|
194
|
+
|
195
|
+
|
196
|
+
<span class='type'>(<tt>Kernel#exit</tt>)</span>
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
—
|
201
|
+
<div class='inline'>
|
202
|
+
<p>exit to shell with success/failure status code</p>
|
203
|
+
</div>
|
204
|
+
|
205
|
+
</li>
|
206
|
+
|
207
|
+
</ul>
|
208
|
+
|
209
|
+
</div><table class="source_code">
|
210
|
+
<tr>
|
211
|
+
<td>
|
212
|
+
<pre class="lines">
|
213
|
+
|
214
|
+
|
215
|
+
30
|
216
|
+
31
|
217
|
+
32
|
218
|
+
33
|
219
|
+
34
|
220
|
+
35
|
221
|
+
36
|
222
|
+
37
|
223
|
+
38
|
224
|
+
39
|
225
|
+
40
|
226
|
+
41
|
227
|
+
42
|
228
|
+
43
|
229
|
+
44
|
230
|
+
45
|
231
|
+
46
|
232
|
+
47
|
233
|
+
48
|
234
|
+
49
|
235
|
+
50
|
236
|
+
51
|
237
|
+
52
|
238
|
+
53
|
239
|
+
54
|
240
|
+
55
|
241
|
+
56
|
242
|
+
57
|
243
|
+
58
|
244
|
+
59</pre>
|
245
|
+
</td>
|
246
|
+
<td>
|
247
|
+
<pre class="code"><span class="info file"># File 'lib/swarm.rb', line 30</span>
|
248
|
+
|
249
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_start'>start</span>
|
250
|
+
<span class='const'>Signal</span><span class='period'>.</span><span class='id identifier rubyid_trap'>trap</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>INT</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_game'>game</span><span class='period'>.</span><span class='id identifier rubyid_stop'>stop</span> <span class='rbrace'>}</span> <span class='comment'># Ctrl-C stops the game gracefully
|
251
|
+
</span>
|
252
|
+
<span class='id identifier rubyid_game'>game</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Swarm/Game.html" title="Swarm::Game (class)">Game</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Swarm/Game.html#initialize-instance_method" title="Swarm::Game#initialize (method)">new</a></span></span>
|
253
|
+
|
254
|
+
<span class='const'><span class='object_link'><a href="Swarm/Console.html" title="Swarm::Console (module)">Console</a></span></span><span class='period'>.</span><span class='id identifier rubyid_open'><span class='object_link'><a href="Swarm/Console.html#open-instance_method" title="Swarm::Console#open (method)">open</a></span></span> <span class='kw'>do</span>
|
255
|
+
|
256
|
+
<span class='id identifier rubyid_game'>game</span><span class='period'>.</span><span class='id identifier rubyid_start'>start</span>
|
257
|
+
|
258
|
+
<span class='const'><span class='object_link'><a href="Swarm/Level.html" title="Swarm::Level (class)">Level</a></span></span><span class='period'>.</span><span class='id identifier rubyid_each'><span class='object_link'><a href="Swarm/Level.html#each-class_method" title="Swarm::Level.each (method)">each</a></span></span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_level'>level</span><span class='op'>|</span>
|
259
|
+
<span class='kw'>next</span> <span class='kw'>if</span> <span class='id identifier rubyid_game'>game</span><span class='period'>.</span><span class='id identifier rubyid_over?'>over?</span>
|
260
|
+
|
261
|
+
<span class='id identifier rubyid_game'>game</span><span class='period'>.</span><span class='id identifier rubyid_setup!'>setup!</span> <span class='id identifier rubyid_level'>level</span>
|
262
|
+
<span class='id identifier rubyid_game'>game</span><span class='period'>.</span><span class='id identifier rubyid_show!'>show!</span>
|
263
|
+
<span class='id identifier rubyid_game'>game</span><span class='period'>.</span><span class='id identifier rubyid_play!'>play!</span> <span class='kw'>until</span> <span class='id identifier rubyid_game'>game</span><span class='period'>.</span><span class='id identifier rubyid_over?'>over?</span> <span class='op'>||</span> <span class='id identifier rubyid_level'>level</span><span class='period'>.</span><span class='id identifier rubyid_over?'>over?</span>
|
264
|
+
<span class='kw'>end</span>
|
265
|
+
|
266
|
+
<span class='id identifier rubyid_game'>game</span><span class='period'>.</span><span class='id identifier rubyid_stop'>stop</span>
|
267
|
+
<span class='kw'>end</span>
|
268
|
+
|
269
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_game'>game</span>
|
270
|
+
|
271
|
+
<span class='id identifier rubyid_exit'>exit</span> <span class='kw'>true</span> <span class='comment'># success!
|
272
|
+
</span><span class='kw'>rescue</span> <span class='op'>=></span> <span class='id identifier rubyid_error'>error</span>
|
273
|
+
<span class='const'><span class='object_link'><a href="Swarm/Console.html" title="Swarm::Console (module)">Console</a></span></span><span class='period'>.</span><span class='id identifier rubyid_close'><span class='object_link'><a href="Swarm/Console.html#close-instance_method" title="Swarm::Console#close (method)">close</a></span></span>
|
274
|
+
|
275
|
+
<span class='id identifier rubyid_warn'>warn</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Swarm encountered an unhandled error</span><span class='tstring_end'>'</span></span>
|
276
|
+
<span class='id identifier rubyid_warn'>warn</span> <span class='id identifier rubyid_error'>error</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_error'>error</span><span class='period'>.</span><span class='id identifier rubyid_backtrace'>backtrace</span>
|
277
|
+
<span class='id identifier rubyid_exit'>exit</span> <span class='kw'>false</span> <span class='comment'># failure!
|
278
|
+
</span><span class='kw'>end</span></pre>
|
279
|
+
</td>
|
280
|
+
</tr>
|
281
|
+
</table>
|
282
|
+
</div>
|
283
|
+
|
284
|
+
</div>
|
285
|
+
|
286
|
+
</div>
|
287
|
+
|
288
|
+
<div id="footer">
|
289
|
+
Generated on Wed Aug 30 07:17:58 2017 by
|
290
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
291
|
+
0.9.9 (ruby-2.4.1).
|
292
|
+
</div>
|
293
|
+
|
294
|
+
</div>
|
295
|
+
</body>
|
296
|
+
</html>
|
@@ -0,0 +1,819 @@
|
|
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: Swarm::Catalog
|
8
|
+
|
9
|
+
— "Swarm" Source Code Documentation
|
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 = "Swarm::Catalog";
|
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 (C)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../Swarm.html" title="Swarm (module)">Swarm</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Catalog</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: Swarm::Catalog
|
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">Swarm::Catalog</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/swarm/catalog.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
<h2>
|
111
|
+
Class Method Summary
|
112
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
113
|
+
</h2>
|
114
|
+
|
115
|
+
<ul class="summary">
|
116
|
+
|
117
|
+
<li class="public ">
|
118
|
+
<span class="summary_signature">
|
119
|
+
|
120
|
+
<a href="#clear-class_method" title="clear (class method)">.<strong>clear</strong>(key) ⇒ Object </a>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
</span>
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
135
|
+
|
136
|
+
</li>
|
137
|
+
|
138
|
+
|
139
|
+
<li class="public ">
|
140
|
+
<span class="summary_signature">
|
141
|
+
|
142
|
+
<a href="#count-class_method" title="count (class method)">.<strong>count</strong>(key) ⇒ Object </a>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
</span>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
157
|
+
|
158
|
+
</li>
|
159
|
+
|
160
|
+
|
161
|
+
<li class="public ">
|
162
|
+
<span class="summary_signature">
|
163
|
+
|
164
|
+
<a href="#delete-class_method" title="delete (class method)">.<strong>delete</strong>(key, value) ⇒ 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="#fetch-class_method" title="fetch (class method)">.<strong>fetch</strong>(key, value, default = nil) ⇒ Object </a>
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
</span>
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
201
|
+
|
202
|
+
</li>
|
203
|
+
|
204
|
+
|
205
|
+
<li class="public ">
|
206
|
+
<span class="summary_signature">
|
207
|
+
|
208
|
+
<a href="#flush-class_method" title="flush (class method)">.<strong>flush</strong>(key, fetch: :keys) ⇒ Object </a>
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
</span>
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
223
|
+
|
224
|
+
</li>
|
225
|
+
|
226
|
+
|
227
|
+
<li class="public ">
|
228
|
+
<span class="summary_signature">
|
229
|
+
|
230
|
+
<a href="#increment-class_method" title="increment (class method)">.<strong>increment</strong>(key, value) ⇒ Object </a>
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
</span>
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
245
|
+
|
246
|
+
</li>
|
247
|
+
|
248
|
+
|
249
|
+
<li class="public ">
|
250
|
+
<span class="summary_signature">
|
251
|
+
|
252
|
+
<a href="#instance-class_method" title="instance (class method)">.<strong>instance</strong> ⇒ Object </a>
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
</span>
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
267
|
+
|
268
|
+
</li>
|
269
|
+
|
270
|
+
|
271
|
+
<li class="public ">
|
272
|
+
<span class="summary_signature">
|
273
|
+
|
274
|
+
<a href="#select-class_method" title="select (class method)">.<strong>select</strong>(*keys, fetch: :keys) ⇒ Object </a>
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
</span>
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
289
|
+
|
290
|
+
</li>
|
291
|
+
|
292
|
+
|
293
|
+
<li class="public ">
|
294
|
+
<span class="summary_signature">
|
295
|
+
|
296
|
+
<a href="#store-class_method" title="store (class method)">.<strong>store</strong>(key, value) ⇒ Object </a>
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
</span>
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
311
|
+
|
312
|
+
</li>
|
313
|
+
|
314
|
+
|
315
|
+
</ul>
|
316
|
+
|
317
|
+
<h2>
|
318
|
+
Instance Method Summary
|
319
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
320
|
+
</h2>
|
321
|
+
|
322
|
+
<ul class="summary">
|
323
|
+
|
324
|
+
<li class="private ">
|
325
|
+
<span class="summary_signature">
|
326
|
+
|
327
|
+
<a href="#categories-instance_method" title="#categories (instance method)">#<strong>categories</strong> ⇒ Object </a>
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
</span>
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
<span class="note title private">private</span>
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
342
|
+
|
343
|
+
</li>
|
344
|
+
|
345
|
+
|
346
|
+
<li class="public ">
|
347
|
+
<span class="summary_signature">
|
348
|
+
|
349
|
+
<a href="#synchronize-instance_method" title="#synchronize (instance method)">#<strong>synchronize</strong> {|categories| ... } ⇒ Object </a>
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
</span>
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
364
|
+
|
365
|
+
</li>
|
366
|
+
|
367
|
+
|
368
|
+
<li class="private ">
|
369
|
+
<span class="summary_signature">
|
370
|
+
|
371
|
+
<a href="#transaction-instance_method" title="#transaction (instance method)">#<strong>transaction</strong> ⇒ Object </a>
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
</span>
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
<span class="note title private">private</span>
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
386
|
+
|
387
|
+
</li>
|
388
|
+
|
389
|
+
|
390
|
+
</ul>
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
<div id="class_method_details" class="method_details_list">
|
396
|
+
<h2>Class Method Details</h2>
|
397
|
+
|
398
|
+
|
399
|
+
<div class="method_details first">
|
400
|
+
<h3 class="signature first" id="clear-class_method">
|
401
|
+
|
402
|
+
.<strong>clear</strong>(key) ⇒ <tt>Object</tt>
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
</h3><table class="source_code">
|
409
|
+
<tr>
|
410
|
+
<td>
|
411
|
+
<pre class="lines">
|
412
|
+
|
413
|
+
|
414
|
+
43
|
415
|
+
44
|
416
|
+
45</pre>
|
417
|
+
</td>
|
418
|
+
<td>
|
419
|
+
<pre class="code"><span class="info file"># File 'lib/swarm/catalog.rb', line 43</span>
|
420
|
+
|
421
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_clear'>clear</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
422
|
+
<span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_categories'>categories</span><span class='op'>|</span> <span class='id identifier rubyid_categories'>categories</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_clear'>clear</span> <span class='rbrace'>}</span>
|
423
|
+
<span class='kw'>end</span></pre>
|
424
|
+
</td>
|
425
|
+
</tr>
|
426
|
+
</table>
|
427
|
+
</div>
|
428
|
+
|
429
|
+
<div class="method_details ">
|
430
|
+
<h3 class="signature " id="count-class_method">
|
431
|
+
|
432
|
+
.<strong>count</strong>(key) ⇒ <tt>Object</tt>
|
433
|
+
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
</h3><table class="source_code">
|
439
|
+
<tr>
|
440
|
+
<td>
|
441
|
+
<pre class="lines">
|
442
|
+
|
443
|
+
|
444
|
+
6
|
445
|
+
7
|
446
|
+
8</pre>
|
447
|
+
</td>
|
448
|
+
<td>
|
449
|
+
<pre class="code"><span class="info file"># File 'lib/swarm/catalog.rb', line 6</span>
|
450
|
+
|
451
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_count'>count</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
452
|
+
<span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_categories'>categories</span><span class='op'>|</span> <span class='id identifier rubyid_categories'>categories</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='rbrace'>}</span>
|
453
|
+
<span class='kw'>end</span></pre>
|
454
|
+
</td>
|
455
|
+
</tr>
|
456
|
+
</table>
|
457
|
+
</div>
|
458
|
+
|
459
|
+
<div class="method_details ">
|
460
|
+
<h3 class="signature " id="delete-class_method">
|
461
|
+
|
462
|
+
.<strong>delete</strong>(key, value) ⇒ <tt>Object</tt>
|
463
|
+
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
|
468
|
+
</h3><table class="source_code">
|
469
|
+
<tr>
|
470
|
+
<td>
|
471
|
+
<pre class="lines">
|
472
|
+
|
473
|
+
|
474
|
+
25
|
475
|
+
26
|
476
|
+
27</pre>
|
477
|
+
</td>
|
478
|
+
<td>
|
479
|
+
<pre class="code"><span class="info file"># File 'lib/swarm/catalog.rb', line 25</span>
|
480
|
+
|
481
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</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>
|
482
|
+
<span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_categories'>categories</span><span class='op'>|</span> <span class='id identifier rubyid_categories'>categories</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_value'>value</span> <span class='rbrace'>}</span>
|
483
|
+
<span class='kw'>end</span></pre>
|
484
|
+
</td>
|
485
|
+
</tr>
|
486
|
+
</table>
|
487
|
+
</div>
|
488
|
+
|
489
|
+
<div class="method_details ">
|
490
|
+
<h3 class="signature " id="fetch-class_method">
|
491
|
+
|
492
|
+
.<strong>fetch</strong>(key, value, default = nil) ⇒ <tt>Object</tt>
|
493
|
+
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
|
498
|
+
</h3><table class="source_code">
|
499
|
+
<tr>
|
500
|
+
<td>
|
501
|
+
<pre class="lines">
|
502
|
+
|
503
|
+
|
504
|
+
10
|
505
|
+
11
|
506
|
+
12</pre>
|
507
|
+
</td>
|
508
|
+
<td>
|
509
|
+
<pre class="code"><span class="info file"># File 'lib/swarm/catalog.rb', line 10</span>
|
510
|
+
|
511
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_fetch'>fetch</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='comma'>,</span> <span class='id identifier rubyid_default'>default</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
512
|
+
<span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_categories'>categories</span><span class='op'>|</span> <span class='id identifier rubyid_categories'>categories</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span> <span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_default'>default</span> <span class='rbrace'>}</span>
|
513
|
+
<span class='kw'>end</span></pre>
|
514
|
+
</td>
|
515
|
+
</tr>
|
516
|
+
</table>
|
517
|
+
</div>
|
518
|
+
|
519
|
+
<div class="method_details ">
|
520
|
+
<h3 class="signature " id="flush-class_method">
|
521
|
+
|
522
|
+
.<strong>flush</strong>(key, fetch: :keys) ⇒ <tt>Object</tt>
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
</h3><table class="source_code">
|
529
|
+
<tr>
|
530
|
+
<td>
|
531
|
+
<pre class="lines">
|
532
|
+
|
533
|
+
|
534
|
+
29
|
535
|
+
30
|
536
|
+
31
|
537
|
+
32
|
538
|
+
33
|
539
|
+
34
|
540
|
+
35</pre>
|
541
|
+
</td>
|
542
|
+
<td>
|
543
|
+
<pre class="code"><span class="info file"># File 'lib/swarm/catalog.rb', line 29</span>
|
544
|
+
|
545
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_flush'>flush</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='label'>fetch:</span> <span class='symbol'>:keys</span><span class='rparen'>)</span>
|
546
|
+
<span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_categories'>categories</span><span class='op'>|</span>
|
547
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_categories'>categories</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
548
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>||=</span> <span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
549
|
+
<span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span> <span class='id identifier rubyid_fetch'>fetch</span>
|
550
|
+
<span class='kw'>end</span>
|
551
|
+
<span class='kw'>end</span></pre>
|
552
|
+
</td>
|
553
|
+
</tr>
|
554
|
+
</table>
|
555
|
+
</div>
|
556
|
+
|
557
|
+
<div class="method_details ">
|
558
|
+
<h3 class="signature " id="increment-class_method">
|
559
|
+
|
560
|
+
.<strong>increment</strong>(key, value) ⇒ <tt>Object</tt>
|
561
|
+
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
|
566
|
+
</h3><table class="source_code">
|
567
|
+
<tr>
|
568
|
+
<td>
|
569
|
+
<pre class="lines">
|
570
|
+
|
571
|
+
|
572
|
+
14
|
573
|
+
15
|
574
|
+
16
|
575
|
+
17
|
576
|
+
18
|
577
|
+
19</pre>
|
578
|
+
</td>
|
579
|
+
<td>
|
580
|
+
<pre class="code"><span class="info file"># File 'lib/swarm/catalog.rb', line 14</span>
|
581
|
+
|
582
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_increment'>increment</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>
|
583
|
+
<span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_categories'>categories</span><span class='op'>|</span>
|
584
|
+
<span class='id identifier rubyid_categories'>categories</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_value'>value</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='int'>0</span>
|
585
|
+
<span class='id identifier rubyid_categories'>categories</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_value'>value</span><span class='rbracket'>]</span> <span class='op'>+=</span> <span class='int'>1</span>
|
586
|
+
<span class='kw'>end</span>
|
587
|
+
<span class='kw'>end</span></pre>
|
588
|
+
</td>
|
589
|
+
</tr>
|
590
|
+
</table>
|
591
|
+
</div>
|
592
|
+
|
593
|
+
<div class="method_details ">
|
594
|
+
<h3 class="signature " id="instance-class_method">
|
595
|
+
|
596
|
+
.<strong>instance</strong> ⇒ <tt>Object</tt>
|
597
|
+
|
598
|
+
|
599
|
+
|
600
|
+
|
601
|
+
|
602
|
+
</h3><table class="source_code">
|
603
|
+
<tr>
|
604
|
+
<td>
|
605
|
+
<pre class="lines">
|
606
|
+
|
607
|
+
|
608
|
+
47
|
609
|
+
48
|
610
|
+
49</pre>
|
611
|
+
</td>
|
612
|
+
<td>
|
613
|
+
<pre class="code"><span class="info file"># File 'lib/swarm/catalog.rb', line 47</span>
|
614
|
+
|
615
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_instance'>instance</span>
|
616
|
+
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='id identifier rubyid_new'>new</span>
|
617
|
+
<span class='kw'>end</span></pre>
|
618
|
+
</td>
|
619
|
+
</tr>
|
620
|
+
</table>
|
621
|
+
</div>
|
622
|
+
|
623
|
+
<div class="method_details ">
|
624
|
+
<h3 class="signature " id="select-class_method">
|
625
|
+
|
626
|
+
.<strong>select</strong>(*keys, fetch: :keys) ⇒ <tt>Object</tt>
|
627
|
+
|
628
|
+
|
629
|
+
|
630
|
+
|
631
|
+
|
632
|
+
</h3><table class="source_code">
|
633
|
+
<tr>
|
634
|
+
<td>
|
635
|
+
<pre class="lines">
|
636
|
+
|
637
|
+
|
638
|
+
37
|
639
|
+
38
|
640
|
+
39
|
641
|
+
40
|
642
|
+
41</pre>
|
643
|
+
</td>
|
644
|
+
<td>
|
645
|
+
<pre class="code"><span class="info file"># File 'lib/swarm/catalog.rb', line 37</span>
|
646
|
+
|
647
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_select'>select</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_keys'>keys</span><span class='comma'>,</span> <span class='label'>fetch:</span> <span class='symbol'>:keys</span><span class='rparen'>)</span>
|
648
|
+
<span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_categories'>categories</span><span class='op'>|</span>
|
649
|
+
<span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_flat_map'>flat_map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='op'>|</span> <span class='id identifier rubyid_categories'>categories</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span> <span class='id identifier rubyid_fetch'>fetch</span> <span class='rbrace'>}</span>
|
650
|
+
<span class='kw'>end</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="store-class_method">
|
659
|
+
|
660
|
+
.<strong>store</strong>(key, value) ⇒ <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
|
+
21
|
673
|
+
22
|
674
|
+
23</pre>
|
675
|
+
</td>
|
676
|
+
<td>
|
677
|
+
<pre class="code"><span class="info file"># File 'lib/swarm/catalog.rb', line 21</span>
|
678
|
+
|
679
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_store'>store</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>
|
680
|
+
<span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_categories'>categories</span><span class='op'>|</span> <span class='id identifier rubyid_categories'>categories</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_store'>store</span> <span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='kw'>true</span> <span class='rbrace'>}</span>
|
681
|
+
<span class='kw'>end</span></pre>
|
682
|
+
</td>
|
683
|
+
</tr>
|
684
|
+
</table>
|
685
|
+
</div>
|
686
|
+
|
687
|
+
</div>
|
688
|
+
|
689
|
+
<div id="instance_method_details" class="method_details_list">
|
690
|
+
<h2>Instance Method Details</h2>
|
691
|
+
|
692
|
+
|
693
|
+
<div class="method_details first">
|
694
|
+
<h3 class="signature first" id="categories-instance_method">
|
695
|
+
|
696
|
+
#<strong>categories</strong> ⇒ <tt>Object</tt> <span class="extras">(private)</span>
|
697
|
+
|
698
|
+
|
699
|
+
|
700
|
+
|
701
|
+
|
702
|
+
</h3><table class="source_code">
|
703
|
+
<tr>
|
704
|
+
<td>
|
705
|
+
<pre class="lines">
|
706
|
+
|
707
|
+
|
708
|
+
66
|
709
|
+
67
|
710
|
+
68</pre>
|
711
|
+
</td>
|
712
|
+
<td>
|
713
|
+
<pre class="code"><span class="info file"># File 'lib/swarm/catalog.rb', line 66</span>
|
714
|
+
|
715
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_categories'>categories</span>
|
716
|
+
<span class='ivar'>@categories</span> <span class='op'>||=</span> <span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_h'>h</span><span class='comma'>,</span> <span class='id identifier rubyid_k'>k</span><span class='op'>|</span> <span class='id identifier rubyid_h'>h</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='rbrace'>}</span>
|
717
|
+
<span class='kw'>end</span></pre>
|
718
|
+
</td>
|
719
|
+
</tr>
|
720
|
+
</table>
|
721
|
+
</div>
|
722
|
+
|
723
|
+
<div class="method_details ">
|
724
|
+
<h3 class="signature " id="synchronize-instance_method">
|
725
|
+
|
726
|
+
#<strong>synchronize</strong> {|categories| ... } ⇒ <tt>Object</tt>
|
727
|
+
|
728
|
+
|
729
|
+
|
730
|
+
|
731
|
+
|
732
|
+
</h3><div class="docstring">
|
733
|
+
<div class="discussion">
|
734
|
+
|
735
|
+
|
736
|
+
</div>
|
737
|
+
</div>
|
738
|
+
<div class="tags">
|
739
|
+
|
740
|
+
<p class="tag_title">Yields:</p>
|
741
|
+
<ul class="yield">
|
742
|
+
|
743
|
+
<li>
|
744
|
+
|
745
|
+
|
746
|
+
<span class='type'>(<tt><span class='object_link'><a href="#categories-instance_method" title="Swarm::Catalog#categories (method)">categories</a></span></tt>)</span>
|
747
|
+
|
748
|
+
|
749
|
+
|
750
|
+
</li>
|
751
|
+
|
752
|
+
</ul>
|
753
|
+
|
754
|
+
</div><table class="source_code">
|
755
|
+
<tr>
|
756
|
+
<td>
|
757
|
+
<pre class="lines">
|
758
|
+
|
759
|
+
|
760
|
+
55
|
761
|
+
56
|
762
|
+
57
|
763
|
+
58</pre>
|
764
|
+
</td>
|
765
|
+
<td>
|
766
|
+
<pre class="code"><span class="info file"># File 'lib/swarm/catalog.rb', line 55</span>
|
767
|
+
|
768
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_synchronize'>synchronize</span>
|
769
|
+
<span class='kw'>yield</span> <span class='id identifier rubyid_categories'>categories</span>
|
770
|
+
<span class='comment'># transaction.synchronize { yield categories }
|
771
|
+
</span><span class='kw'>end</span></pre>
|
772
|
+
</td>
|
773
|
+
</tr>
|
774
|
+
</table>
|
775
|
+
</div>
|
776
|
+
|
777
|
+
<div class="method_details ">
|
778
|
+
<h3 class="signature " id="transaction-instance_method">
|
779
|
+
|
780
|
+
#<strong>transaction</strong> ⇒ <tt>Object</tt> <span class="extras">(private)</span>
|
781
|
+
|
782
|
+
|
783
|
+
|
784
|
+
|
785
|
+
|
786
|
+
</h3><table class="source_code">
|
787
|
+
<tr>
|
788
|
+
<td>
|
789
|
+
<pre class="lines">
|
790
|
+
|
791
|
+
|
792
|
+
62
|
793
|
+
63
|
794
|
+
64</pre>
|
795
|
+
</td>
|
796
|
+
<td>
|
797
|
+
<pre class="code"><span class="info file"># File 'lib/swarm/catalog.rb', line 62</span>
|
798
|
+
|
799
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_transaction'>transaction</span>
|
800
|
+
<span class='ivar'>@transaction</span> <span class='op'>||=</span> <span class='const'>Mutex</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
801
|
+
<span class='kw'>end</span></pre>
|
802
|
+
</td>
|
803
|
+
</tr>
|
804
|
+
</table>
|
805
|
+
</div>
|
806
|
+
|
807
|
+
</div>
|
808
|
+
|
809
|
+
</div>
|
810
|
+
|
811
|
+
<div id="footer">
|
812
|
+
Generated on Wed Aug 30 07:17:59 2017 by
|
813
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
814
|
+
0.9.9 (ruby-2.4.1).
|
815
|
+
</div>
|
816
|
+
|
817
|
+
</div>
|
818
|
+
</body>
|
819
|
+
</html>
|