multiples 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -0
- data/Rakefile +5 -0
- data/lib/multiples/multiples_enumerator.rb +5 -0
- data/lib/multiples/version.rb +1 -1
- data/multiples.gemspec +3 -2
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c148b2dbc34e3fe1fd0b1ab3f77580923d8db47
|
4
|
+
data.tar.gz: 1cc36f198a041ef08285c0f31279f317e0d917bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a67ca997e635bd02a675b6ccaadc0aadf18cea97f5cad749f16e97e5ab1547b04a5450d46573cf9d552e78cf01d2e23fccfd9e18edd527081f10851b262c484e
|
7
|
+
data.tar.gz: 3fb75d42c0cafe86d2ce87d9cd8a1cf0013509925e30df4f9f3f515496a3106096a3ef74543fe1e106ee46e150f1177d603eb16ecbeb88719520bde72d56035a
|
data/README.md
CHANGED
@@ -76,8 +76,28 @@ x.prev
|
|
76
76
|
# => 30
|
77
77
|
x.phase
|
78
78
|
# => 0
|
79
|
+
|
80
|
+
y = Multiples.new(3,5)
|
81
|
+
|
82
|
+
y.lazy.take(4).to_a
|
83
|
+
# => [3, 5, 6, 9]
|
84
|
+
y.next
|
85
|
+
# => 10
|
86
|
+
y.prev
|
87
|
+
# => 9
|
88
|
+
|
89
|
+
y.lazy.select {|v| v % 7 == 0 }.take(14).to_a
|
90
|
+
# => [21, 35, 42, 63, 70, 84, 105, 126, 140, 147, 168, 175, 189, 210]
|
79
91
|
```
|
80
92
|
|
93
|
+
## Benchmark
|
94
|
+
|
95
|
+
If you reuse the Enumerator (rather than re-initialzing it) you will gain a
|
96
|
+
performance advantage of at least 100% (2x original). If you create a new Enumerator each time
|
97
|
+
you use it your performance will be 30% worse than if you had not used this gem.
|
98
|
+
See the benchmark file in test/benches for an example and run `rake bench` to see
|
99
|
+
the results for yourself.
|
100
|
+
|
81
101
|
## Development
|
82
102
|
|
83
103
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/Rakefile
CHANGED
data/lib/multiples/version.rb
CHANGED
data/multiples.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Multiples::VERSION
|
9
9
|
spec.authors = ["Daniel P. Clark"]
|
10
10
|
spec.email = ["6ftdan@gmail.com"]
|
11
|
-
spec.summary = %q{Creates enumerators that step through integers from a union of two multiples
|
12
|
-
spec.description = %q{Creates enumerators that step through integers from a union of two multiples. A pattern from the two numbers is determined (much like two frequencies create a pattern) and the resulting palindrome is given to a custom Enumerator for you to use.
|
11
|
+
spec.summary = %q{Creates enumerators that step through integers from a union of two multiples}
|
12
|
+
spec.description = %q{Creates enumerators that step through integers from a union of two multiples. A pattern from the two numbers is determined (much like two frequencies create a pattern) and the resulting palindrome is given to a custom Enumerator for you to use.}
|
13
13
|
spec.license = "MIT"
|
14
14
|
|
15
15
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
@@ -22,4 +22,5 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.13"
|
23
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
24
|
spec.add_development_dependency "minitest", "~> 5.0"
|
25
|
+
spec.add_development_dependency "benchmark-ips", "~> 2.7"
|
25
26
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multiples
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel P. Clark
|
@@ -52,10 +52,24 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: benchmark-ips
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.7'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.7'
|
55
69
|
description: Creates enumerators that step through integers from a union of two multiples.
|
56
70
|
A pattern from the two numbers is determined (much like two frequencies create a
|
57
71
|
pattern) and the resulting palindrome is given to a custom Enumerator for you to
|
58
|
-
use.
|
72
|
+
use.
|
59
73
|
email:
|
60
74
|
- 6ftdan@gmail.com
|
61
75
|
executables: []
|
@@ -97,5 +111,5 @@ rubyforge_project:
|
|
97
111
|
rubygems_version: 2.6.4
|
98
112
|
signing_key:
|
99
113
|
specification_version: 4
|
100
|
-
summary: Creates enumerators that step through integers from a union of two multiples
|
114
|
+
summary: Creates enumerators that step through integers from a union of two multiples
|
101
115
|
test_files: []
|