sixarm_ruby_integer_map 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Rakefile +10 -0
- data/lib/sixarm_ruby_integer_map.rb +6 -0
- data/lib/sixarm_ruby_integer_map/integer/map.rb +30 -0
- data/test/sixarm_ruby_integer_map_test.rb +8 -0
- data/test/sixarm_ruby_integer_map_test/integer/map_test.rb +28 -0
- metadata +285 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9e6e2b33c6d11d90b66d0f027da86307270765d27e0363a67bbad15701155562
|
4
|
+
data.tar.gz: b459f4ef5566565d8507cff029aa7ff441dbae0f808a1fbfb8336a5c5eeeb7e2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8f707ddda9e0ceff5b0982bcaa634694cc592a0db3ff2bcdd75b6c47507ac4994bbcbe0c4137f92e9909c5ebe806068fdda627d1264513866e471f1219093b18
|
7
|
+
data.tar.gz: 0721dbf26caba98d341ccc99780869c37e797eff4c600c4e3c18dc75a283fcd6c5daef6366f839f58a89e3230c27f9a3e9ae34811dec2cf6335852e35f7fcfea
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
=begin rdoc
|
3
|
+
Please see README
|
4
|
+
=end
|
5
|
+
|
6
|
+
class Integer
|
7
|
+
|
8
|
+
# Syntactic sugar to yield n times to a block.
|
9
|
+
#
|
10
|
+
# ## Comparison to Integer#times
|
11
|
+
#
|
12
|
+
# Integer#maps is similar to Integer#times except that the output from each
|
13
|
+
# call to the block is captured in an array element and that array is
|
14
|
+
# returned to the calling code.
|
15
|
+
#
|
16
|
+
# @return an array of results
|
17
|
+
#
|
18
|
+
# @example Generate an array of three random numbers
|
19
|
+
# 3.map{rand}
|
20
|
+
# => [0.0248131784304143, 0.814666170190905, 0.15812816258206]
|
21
|
+
#
|
22
|
+
# @example Multiply the current index
|
23
|
+
# 3.map{|i| i * 2}
|
24
|
+
# => [0, 2, 4]
|
25
|
+
#
|
26
|
+
def map
|
27
|
+
self.times.map{|i| yield i}
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "sixarm_ruby_integer_map_test"
|
3
|
+
|
4
|
+
describe Integer do
|
5
|
+
|
6
|
+
describe "map" do
|
7
|
+
|
8
|
+
describe "with block" do
|
9
|
+
|
10
|
+
it "return an array" do
|
11
|
+
actual = 3.map{"x"}
|
12
|
+
expect(actual).must_equal ["x", "x", "x"]
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "with block and index" do
|
18
|
+
|
19
|
+
it "return an array that demonstrates the use of the index" do
|
20
|
+
actual = 3.map{|i| i * 3 }
|
21
|
+
expect(actual).must_equal [0, 3, 6]
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,285 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sixarm_ruby_integer_map
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- SixArm
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIFPDCCAyQCCQDx7Y5LWGuPPzANBgkqhkiG9w0BAQsFADBgMQswCQYDVQQGEwJV
|
14
|
+
UzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEP
|
15
|
+
MA0GA1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
|
+
KoZIhvcNAQELBQADggIBALIBNN7zUhFldUaXWGwv6032ZwM2Sm1U8VF8YaH71NLg
|
31
|
+
FhlcuJ0JLkGlxT0/68acS0EwoqOEgaHyPx8eodjyDv2MuJlWJGXIgHgLD66Tu0VA
|
32
|
+
Wt1sgA823Rl35WVSMqiyoxwsrGFwMtayNrrlpdhB8Ny8CMA2NfKyEJkh4+xlE72a
|
33
|
+
D8Eu8NFr9Tt5lHWXdZBI5BhzhQxPPxeIuw0wZ3+kiwxRie7K4XhKsOIrPmu2i6QV
|
34
|
+
Yl/663wZgWpqrroSnc3PE3lsuTW7quUvayjtqMTU2qrh7i21oB+/Nn+I6gcxYJZb
|
35
|
+
UlK+tvsqoM94U6sFTjw9mDt62MLQGrJtHShS+ZZiGmWj1sKreuwGJnCVDoBk15xa
|
36
|
+
oqlvfvLAMBCqlfrHhvGUfbIMgzb9uXNmCjzYMsQxuIgF6IMis6Kq02NBAR91HPMe
|
37
|
+
2RoY7CdBHMxW+O0tgS2xoQbOwb+ti1j4MbsWpCqS9Mteck0Z7jZpRRrUDjXU+/7Z
|
38
|
+
RmW9HX0oLIoCBDChCcEKG0Ma4IvHUgjv47f5iYpkXuhifiK4xMG/s+T5Euw3Wg9J
|
39
|
+
tzpk/VnZXj7Ek/earx+N/Z+Wtnl2xENm5IF8SFPeI1HFa9NH47pqtxF1YKpNIEVc
|
40
|
+
2xa2BNHSePe7tys/2hbmZuyMu8X5ERmovsabSXB3a+YwtJh5c2jhA21wF7986s0q
|
41
|
+
-----END CERTIFICATE-----
|
42
|
+
date: 2019-04-19 00:00:00.000000000 Z
|
43
|
+
dependencies:
|
44
|
+
- !ruby/object:Gem::Dependency
|
45
|
+
name: minitest
|
46
|
+
requirement: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 5.11.1
|
51
|
+
- - "<"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '6'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 5.11.1
|
61
|
+
- - "<"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '6'
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: sixarm_ruby_minitest_extensions
|
66
|
+
requirement: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 1.0.8
|
71
|
+
- - "<"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '2'
|
74
|
+
type: :development
|
75
|
+
prerelease: false
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 1.0.8
|
81
|
+
- - "<"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '2'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: rake
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 12.3.0
|
91
|
+
- - "<"
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '13'
|
94
|
+
type: :development
|
95
|
+
prerelease: false
|
96
|
+
version_requirements: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: 12.3.0
|
101
|
+
- - "<"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '13'
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: simplecov
|
106
|
+
requirement: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.14.1
|
111
|
+
- - "<"
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '2'
|
114
|
+
type: :development
|
115
|
+
prerelease: false
|
116
|
+
version_requirements: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: 0.14.1
|
121
|
+
- - "<"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '2'
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: flog
|
126
|
+
requirement: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: 4.6.1
|
131
|
+
- - "<"
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '5'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: 4.6.1
|
141
|
+
- - "<"
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '5'
|
144
|
+
- !ruby/object:Gem::Dependency
|
145
|
+
name: flay
|
146
|
+
requirement: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: 2.10.0
|
151
|
+
- - "<"
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '3'
|
154
|
+
type: :development
|
155
|
+
prerelease: false
|
156
|
+
version_requirements: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: 2.10.0
|
161
|
+
- - "<"
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '3'
|
164
|
+
- !ruby/object:Gem::Dependency
|
165
|
+
name: reek
|
166
|
+
requirement: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: 4.7.3
|
171
|
+
- - "<"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '5'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 4.7.3
|
181
|
+
- - "<"
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '5'
|
184
|
+
- !ruby/object:Gem::Dependency
|
185
|
+
name: rubycritic
|
186
|
+
requirement: !ruby/object:Gem::Requirement
|
187
|
+
requirements:
|
188
|
+
- - ">="
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: 3.3.0
|
191
|
+
- - "<"
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '4'
|
194
|
+
type: :development
|
195
|
+
prerelease: false
|
196
|
+
version_requirements: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: 3.3.0
|
201
|
+
- - "<"
|
202
|
+
- !ruby/object:Gem::Version
|
203
|
+
version: '4'
|
204
|
+
- !ruby/object:Gem::Dependency
|
205
|
+
name: rubocop
|
206
|
+
requirement: !ruby/object:Gem::Requirement
|
207
|
+
requirements:
|
208
|
+
- - ">="
|
209
|
+
- !ruby/object:Gem::Version
|
210
|
+
version: 0.52.1
|
211
|
+
- - "<"
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: '1'
|
214
|
+
type: :development
|
215
|
+
prerelease: false
|
216
|
+
version_requirements: !ruby/object:Gem::Requirement
|
217
|
+
requirements:
|
218
|
+
- - ">="
|
219
|
+
- !ruby/object:Gem::Version
|
220
|
+
version: 0.52.1
|
221
|
+
- - "<"
|
222
|
+
- !ruby/object:Gem::Version
|
223
|
+
version: '1'
|
224
|
+
- !ruby/object:Gem::Dependency
|
225
|
+
name: rubocop-performance
|
226
|
+
requirement: !ruby/object:Gem::Requirement
|
227
|
+
requirements:
|
228
|
+
- - ">="
|
229
|
+
- !ruby/object:Gem::Version
|
230
|
+
version: 1.1.0
|
231
|
+
- - "<"
|
232
|
+
- !ruby/object:Gem::Version
|
233
|
+
version: '2'
|
234
|
+
type: :development
|
235
|
+
prerelease: false
|
236
|
+
version_requirements: !ruby/object:Gem::Requirement
|
237
|
+
requirements:
|
238
|
+
- - ">="
|
239
|
+
- !ruby/object:Gem::Version
|
240
|
+
version: 1.1.0
|
241
|
+
- - "<"
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: '2'
|
244
|
+
description: Integer#map method to run a block multiple times
|
245
|
+
email: sixarm@sixarm.com
|
246
|
+
executables: []
|
247
|
+
extensions: []
|
248
|
+
extra_rdoc_files: []
|
249
|
+
files:
|
250
|
+
- Rakefile
|
251
|
+
- lib/sixarm_ruby_integer_map.rb
|
252
|
+
- lib/sixarm_ruby_integer_map/integer/map.rb
|
253
|
+
- test/sixarm_ruby_integer_map_test.rb
|
254
|
+
- test/sixarm_ruby_integer_map_test/integer/map_test.rb
|
255
|
+
homepage: http://sixarm.com/
|
256
|
+
licenses:
|
257
|
+
- Apache-2.0
|
258
|
+
- Artistic-2.0
|
259
|
+
- BSD-3-Clause
|
260
|
+
- GPL-3.0
|
261
|
+
- MIT
|
262
|
+
- MPL-2.0
|
263
|
+
metadata: {}
|
264
|
+
post_install_message:
|
265
|
+
rdoc_options: []
|
266
|
+
require_paths:
|
267
|
+
- lib
|
268
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
269
|
+
requirements:
|
270
|
+
- - ">="
|
271
|
+
- !ruby/object:Gem::Version
|
272
|
+
version: '2.6'
|
273
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
274
|
+
requirements:
|
275
|
+
- - ">="
|
276
|
+
- !ruby/object:Gem::Version
|
277
|
+
version: '0'
|
278
|
+
requirements: []
|
279
|
+
rubygems_version: 3.0.3
|
280
|
+
signing_key:
|
281
|
+
specification_version: 4
|
282
|
+
summary: SixArm.com → Ruby → Integer → map method
|
283
|
+
test_files:
|
284
|
+
- test/sixarm_ruby_integer_map_test.rb
|
285
|
+
- test/sixarm_ruby_integer_map_test/integer/map_test.rb
|
metadata.gz.sig
ADDED
Binary file
|