search_space_splitter 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -1
- data/lib/search_space_splitter.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -11,7 +11,7 @@ Splits a search space, represented by an array of ranges, into similarly sized s
|
|
11
11
|
require 'search_splace_splitter'
|
12
12
|
|
13
13
|
SearchSpaceSplitter.split([1..2, 1..3])
|
14
|
-
#=> [[1..1, 1..3], [
|
14
|
+
#=> [[1..1, 1..3], [2..2, 1..3]]
|
15
15
|
|
16
16
|
SearchSpaceSplitter.split([1..3, 1..5])
|
17
17
|
#=> [[1..3, 1..3], [1..3, 4..5]]
|
@@ -49,3 +49,9 @@ SearchSpaceSplitter.split([1..3, 1..4, 1..5], :into => 11)
|
|
49
49
|
SearchSpaceSplitter.split([1..2], :into => 999)
|
50
50
|
#=> [[1..1], [2..2]]
|
51
51
|
```
|
52
|
+
|
53
|
+
## Contribution
|
54
|
+
|
55
|
+
Feel free to contribute. No commit is too small.
|
56
|
+
|
57
|
+
You should follow me: [@cpatuzzo](https://twitter.com/cpatuzzo)
|
@@ -6,7 +6,7 @@ class SearchSpaceSplitter
|
|
6
6
|
into = params[:into] || 2
|
7
7
|
|
8
8
|
atomic = ranges.all? { |r| r.count == 1 }
|
9
|
-
return ranges if into == 1 || atomic
|
9
|
+
return [ranges] if into == 1 || atomic
|
10
10
|
|
11
11
|
ri = ranges.each_with_index
|
12
12
|
divisible = lambda { |c| (into % c).zero? || (c % into).zero? }
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: search_space_splitter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Christopher Patuzzo
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-11-
|
18
|
+
date: 2012-11-03 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: range_splitter
|