sixarm_ruby_array_slice 2.1.4 → 2.1.6
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Rakefile +4 -4
- data/lib/sixarm_ruby_array_slice.rb +1 -65
- data/lib/sixarm_ruby_array_slice/array.rb +66 -0
- data/test/sixarm_ruby_array_slice_test.rb +9 -105
- data/test/sixarm_ruby_array_slice_test/array_test.rb +104 -0
- metadata +134 -41
- metadata.gz.sig +0 -0
- data/.gemtest +0 -0
- data/README.md +0 -78
- data/VERSION +0 -1
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ff77a74133d4988170b58c17c27bea75378c1a89
|
4
|
+
data.tar.gz: 6fce1f9f68829d45c509d9380b724f8aee24667b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e5e11679627e98867a0c33f75559b0ea4e7786f1dd391706ac29a88de33f9600dde05f61547aee98eb424c8bf8e05d6d4686196414b035508e7a047db359839d
|
7
|
+
data.tar.gz: 542f529026779212f8fbf1137b54f9f3e9554062ff2ee72f302951aacd69f77d39ad5fb163dcedfb90a0fab3dd50c6acdf3602ff8e36ba8ed0c9595878a5b4e5
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/Rakefile
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require
|
3
|
-
require
|
2
|
+
require "rake"
|
3
|
+
require "rake/testtask"
|
4
4
|
|
5
5
|
Rake::TestTask.new(:test) do |t|
|
6
|
-
t.libs
|
7
|
-
t.pattern =
|
6
|
+
t.libs.push("lib", "test")
|
7
|
+
t.pattern = "test/**/*.rb"
|
8
8
|
end
|
@@ -3,68 +3,4 @@
|
|
3
3
|
Please see README
|
4
4
|
=end
|
5
5
|
|
6
|
-
|
7
|
-
class Array
|
8
|
-
|
9
|
-
|
10
|
-
# Slice the array into sub-arrays of size _n_.
|
11
|
-
#
|
12
|
-
# @return [Array<Array<Object>>] slices where each slice has approximately _n_ items
|
13
|
-
#
|
14
|
-
# If the array divides evenly then each slice has _n_ items:
|
15
|
-
#
|
16
|
-
# [1,2,3,4,5,6,7,8].slice_by_size(2) => [[1,2],[3,4],[5,6],[7,8]]
|
17
|
-
# [1,2,3,4,5,6,7,8].slice_by_size(4) => [[1,2,3,4],[5,6,7,8]]
|
18
|
-
#
|
19
|
-
# If the array does not divide evenly then the last slice will be smaller:
|
20
|
-
#
|
21
|
-
# [1,2,3,4,5,6,7,8].slice_by_size(3) => [[1,2,3],[4,5,6],[7,8]]
|
22
|
-
#
|
23
|
-
# If the array size is small compared to _n_ then the results will be best-attempt:
|
24
|
-
#
|
25
|
-
# [1,2,3,4,5,6,7,8].slice_by_size(7) => [[1,2,3,4,5,6,7],[8]]
|
26
|
-
#
|
27
|
-
# Compare #slice_by_share
|
28
|
-
|
29
|
-
def slice_by_size(size)
|
30
|
-
(size.is_a? Integer) or (raise ArgumentError, "size must be an integer")
|
31
|
-
(size > 0) or (raise ArgumentError, "size must be > 0")
|
32
|
-
arr=[]
|
33
|
-
index=0
|
34
|
-
while index<length
|
35
|
-
arr.push self[index...(index+size)]
|
36
|
-
index+=size
|
37
|
-
end
|
38
|
-
return arr
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
# Slice the array into _n_ sub-arrays of the same size.
|
43
|
-
#
|
44
|
-
# @return [Array<Array<Object>>] _n_ slices where each slice is approximately the same size.
|
45
|
-
#
|
46
|
-
# If the array divides evenly, then each slice has size/n items:
|
47
|
-
#
|
48
|
-
# [1,2,3,4,5,6,7,8].slice_by_share(2) => [[1,2,3,4],[5,6,7,8]]
|
49
|
-
# [1,2,3,4,5,6,7,8].slice_by_share(4) => [[1,2],[3,4],[5,6],[7,8]]
|
50
|
-
#
|
51
|
-
# If the array does not divide evenly then the latter slices will be smaller:
|
52
|
-
#
|
53
|
-
# [1,2,3,4,5,6,7,8].slice_by_share(3) => [[1,2,3],[4,5,6],[7,8]]
|
54
|
-
#
|
55
|
-
# If the array size is small compared to _n_ then the results will be best-attempt:
|
56
|
-
#
|
57
|
-
# [1,2,3,4,5,6,7,8].slice_by_share(7) => [[1,2],[3,4],[5,6],[7,8],[],[],[]]
|
58
|
-
#
|
59
|
-
# Compare #slice_by_size
|
60
|
-
|
61
|
-
def slice_by_share(share)
|
62
|
-
(share.is_a? Integer) or (raise ArgumentError, "share must be an integer")
|
63
|
-
(share > 0) or (raise ArgumentError, "share must be > 0")
|
64
|
-
arr = slice_by_size((length.to_f/share.to_f).ceil)
|
65
|
-
while arr.size < share do arr << [] end
|
66
|
-
return arr
|
67
|
-
end
|
68
|
-
|
69
|
-
|
70
|
-
end
|
6
|
+
require_relative "sixarm_ruby_array_slice/array"
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
=begin rdoc
|
3
|
+
Array extentions.
|
4
|
+
=end
|
5
|
+
|
6
|
+
class Array
|
7
|
+
|
8
|
+
# Slice the array into sub-arrays of size _n_.
|
9
|
+
#
|
10
|
+
# @return [Array<Array<Object>>] slices where each slice has approximately _n_ items
|
11
|
+
#
|
12
|
+
# If the array divides evenly then each slice has _n_ items:
|
13
|
+
#
|
14
|
+
# [1,2,3,4,5,6,7,8].slice_by_size(2) => [[1,2],[3,4],[5,6],[7,8]]
|
15
|
+
# [1,2,3,4,5,6,7,8].slice_by_size(4) => [[1,2,3,4],[5,6,7,8]]
|
16
|
+
#
|
17
|
+
# If the array does not divide evenly then the last slice will be smaller:
|
18
|
+
#
|
19
|
+
# [1,2,3,4,5,6,7,8].slice_by_size(3) => [[1,2,3],[4,5,6],[7,8]]
|
20
|
+
#
|
21
|
+
# If the array size is small compared to _n_ then the results will be best-attempt:
|
22
|
+
#
|
23
|
+
# [1,2,3,4,5,6,7,8].slice_by_size(7) => [[1,2,3,4,5,6,7],[8]]
|
24
|
+
#
|
25
|
+
# Compare #slice_by_share
|
26
|
+
|
27
|
+
def slice_by_size(size)
|
28
|
+
(size.is_a? Integer) or (raise ArgumentError, "size must be an integer")
|
29
|
+
(size > 0) or (raise ArgumentError, "size must be > 0")
|
30
|
+
arr=[]
|
31
|
+
index=0
|
32
|
+
while index<length
|
33
|
+
arr.push self[index...(index+size)]
|
34
|
+
index+=size
|
35
|
+
end
|
36
|
+
return arr
|
37
|
+
end
|
38
|
+
|
39
|
+
# Slice the array into _n_ sub-arrays of the same size.
|
40
|
+
#
|
41
|
+
# @return [Array<Array<Object>>] _n_ slices where each slice is approximately the same size.
|
42
|
+
#
|
43
|
+
# If the array divides evenly, then each slice has size/n items:
|
44
|
+
#
|
45
|
+
# [1,2,3,4,5,6,7,8].slice_by_share(2) => [[1,2,3,4],[5,6,7,8]]
|
46
|
+
# [1,2,3,4,5,6,7,8].slice_by_share(4) => [[1,2],[3,4],[5,6],[7,8]]
|
47
|
+
#
|
48
|
+
# If the array does not divide evenly then the latter slices will be smaller:
|
49
|
+
#
|
50
|
+
# [1,2,3,4,5,6,7,8].slice_by_share(3) => [[1,2,3],[4,5,6],[7,8]]
|
51
|
+
#
|
52
|
+
# If the array size is small compared to _n_ then the results will be best-attempt:
|
53
|
+
#
|
54
|
+
# [1,2,3,4,5,6,7,8].slice_by_share(7) => [[1,2],[3,4],[5,6],[7,8],[],[],[]]
|
55
|
+
#
|
56
|
+
# Compare #slice_by_size
|
57
|
+
|
58
|
+
def slice_by_share(share)
|
59
|
+
(share.is_a? Integer) or (raise ArgumentError, "share must be an integer")
|
60
|
+
(share > 0) or (raise ArgumentError, "share must be > 0")
|
61
|
+
arr = slice_by_size((length.to_f/share.to_f).ceil)
|
62
|
+
while arr.size < share do arr << [] end
|
63
|
+
return arr
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
@@ -1,107 +1,11 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require
|
3
|
-
require
|
2
|
+
require "minitest/autorun"
|
3
|
+
require "coveralls"
|
4
|
+
require "simplecov"
|
5
|
+
Coveralls.wear!
|
6
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
7
|
+
SimpleCov::Formatter::HTMLFormatter,
|
8
|
+
Coveralls::SimpleCov::Formatter
|
9
|
+
]
|
4
10
|
SimpleCov.start
|
5
|
-
require
|
6
|
-
|
7
|
-
describe Array do
|
8
|
-
|
9
|
-
before do
|
10
|
-
A ||= [1,2,3,4,5,6,7,8]
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "#slice_by_size" do
|
14
|
-
|
15
|
-
it "with 1 count" do
|
16
|
-
A.slice_by_size(1).must_equal [[1],[2],[3],[4],[5],[6],[7],[8]]
|
17
|
-
end
|
18
|
-
|
19
|
-
it "with balanced results" do
|
20
|
-
A.slice_by_size(2).must_equal [[1,2],[3,4],[5,6],[7,8]]
|
21
|
-
A.slice_by_size(4).must_equal [[1,2,3,4],[5,6,7,8]]
|
22
|
-
end
|
23
|
-
|
24
|
-
it "with unbalanced results" do
|
25
|
-
A.slice_by_size(3).must_equal [[1,2,3],[4,5,6],[7,8]]
|
26
|
-
end
|
27
|
-
|
28
|
-
it "with very unbalanced results" do
|
29
|
-
A.slice_by_size(7).must_equal [[1,2,3,4,5,6,7],[8]]
|
30
|
-
end
|
31
|
-
|
32
|
-
it "with empty input" do
|
33
|
-
[].slice_by_size(1).must_equal []
|
34
|
-
end
|
35
|
-
|
36
|
-
it "with 0 count" do
|
37
|
-
assert_raise ArgumentError do
|
38
|
-
A.slice_by_size(0)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
it "with negative count" do
|
43
|
-
assert_raise ArgumentError do
|
44
|
-
A.slice_by_size(-1)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
it "with float count" do
|
49
|
-
assert_raise ArgumentError do
|
50
|
-
A.slice_by_size(1.234)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
it "with non numeric count" do
|
55
|
-
assert_raise ArgumentError do
|
56
|
-
A.slice_by_size(1.234)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
describe "#slice_by_share" do
|
63
|
-
|
64
|
-
it "with 1 count" do
|
65
|
-
A.slice_by_share(1).must_equal [[1,2,3,4,5,6,7,8]]
|
66
|
-
end
|
67
|
-
|
68
|
-
it "with balanced results" do
|
69
|
-
A.slice_by_share(2).must_equal [[1,2,3,4],[5,6,7,8]]
|
70
|
-
A.slice_by_share(4).must_equal [[1,2],[3,4],[5,6],[7,8]]
|
71
|
-
end
|
72
|
-
|
73
|
-
it "with unbalanced results" do
|
74
|
-
A.slice_by_share(3).must_equal [[1,2,3],[4,5,6],[7,8]]
|
75
|
-
end
|
76
|
-
|
77
|
-
it "with very unbalanced results" do
|
78
|
-
A.slice_by_share(7).must_equal [[1,2],[3,4],[5,6],[7,8],[],[],[]]
|
79
|
-
end
|
80
|
-
|
81
|
-
it "with zero count" do
|
82
|
-
assert_raise ArgumentError do
|
83
|
-
A.slice_by_share(0)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
it "with negative count" do
|
88
|
-
assert_raise ArgumentError do
|
89
|
-
A.slice_by_share(-1)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
it "with float count" do
|
94
|
-
assert_raise ArgumentError do
|
95
|
-
A.slice_by_share(1.234)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
it "with non numeric count" do
|
100
|
-
assert_raise ArgumentError do
|
101
|
-
A.slice_by_share("")
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
end
|
106
|
-
|
107
|
-
end
|
11
|
+
require "sixarm_ruby_array_slice"
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "sixarm_ruby_array_slice_test"
|
3
|
+
|
4
|
+
describe Array do
|
5
|
+
|
6
|
+
before do
|
7
|
+
A ||= [1,2,3,4,5,6,7,8]
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "#slice_by_size" do
|
11
|
+
|
12
|
+
it "with 1 count" do
|
13
|
+
A.slice_by_size(1).must_equal [[1],[2],[3],[4],[5],[6],[7],[8]]
|
14
|
+
end
|
15
|
+
|
16
|
+
it "with balanced results" do
|
17
|
+
A.slice_by_size(2).must_equal [[1,2],[3,4],[5,6],[7,8]]
|
18
|
+
A.slice_by_size(4).must_equal [[1,2,3,4],[5,6,7,8]]
|
19
|
+
end
|
20
|
+
|
21
|
+
it "with unbalanced results" do
|
22
|
+
A.slice_by_size(3).must_equal [[1,2,3],[4,5,6],[7,8]]
|
23
|
+
end
|
24
|
+
|
25
|
+
it "with very unbalanced results" do
|
26
|
+
A.slice_by_size(7).must_equal [[1,2,3,4,5,6,7],[8]]
|
27
|
+
end
|
28
|
+
|
29
|
+
it "with empty input" do
|
30
|
+
[].slice_by_size(1).must_equal []
|
31
|
+
end
|
32
|
+
|
33
|
+
it "with 0 count" do
|
34
|
+
assert_raise ArgumentError do
|
35
|
+
A.slice_by_size(0)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
it "with negative count" do
|
40
|
+
assert_raise ArgumentError do
|
41
|
+
A.slice_by_size(-1)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
it "with float count" do
|
46
|
+
assert_raise ArgumentError do
|
47
|
+
A.slice_by_size(1.234)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
it "with non numeric count" do
|
52
|
+
assert_raise ArgumentError do
|
53
|
+
A.slice_by_size(1.234)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "#slice_by_share" do
|
60
|
+
|
61
|
+
it "with 1 count" do
|
62
|
+
A.slice_by_share(1).must_equal [[1,2,3,4,5,6,7,8]]
|
63
|
+
end
|
64
|
+
|
65
|
+
it "with balanced results" do
|
66
|
+
A.slice_by_share(2).must_equal [[1,2,3,4],[5,6,7,8]]
|
67
|
+
A.slice_by_share(4).must_equal [[1,2],[3,4],[5,6],[7,8]]
|
68
|
+
end
|
69
|
+
|
70
|
+
it "with unbalanced results" do
|
71
|
+
A.slice_by_share(3).must_equal [[1,2,3],[4,5,6],[7,8]]
|
72
|
+
end
|
73
|
+
|
74
|
+
it "with very unbalanced results" do
|
75
|
+
A.slice_by_share(7).must_equal [[1,2],[3,4],[5,6],[7,8],[],[],[]]
|
76
|
+
end
|
77
|
+
|
78
|
+
it "with zero count" do
|
79
|
+
assert_raise ArgumentError do
|
80
|
+
A.slice_by_share(0)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
it "with negative count" do
|
85
|
+
assert_raise ArgumentError do
|
86
|
+
A.slice_by_share(-1)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
it "with float count" do
|
91
|
+
assert_raise ArgumentError do
|
92
|
+
A.slice_by_share(1.234)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
it "with non numeric count" do
|
97
|
+
assert_raise ArgumentError do
|
98
|
+
A.slice_by_share("")
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
metadata
CHANGED
@@ -1,78 +1,171 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sixarm_ruby_array_slice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
5
|
-
prerelease:
|
4
|
+
version: 2.1.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- SixArm
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain:
|
12
|
-
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-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RTIGlfhlIFkMV3wT0LTsNznUPsoo6e+IW/tDrk23mrNRY6QynTETb+QVIevuzD9m
|
41
|
+
Drcxp/zlVhud+a0ezdnyNvF520arJWvqA4GrOo8F+TT2vVrjscgYjiVGdSq+8wQv
|
42
|
+
Efa5jhe8QwG7R1rdpMMP5yBSAqWuFBczMveX5j4rp9Ifw5/XsZbgwcmdm26bjhzh
|
43
|
+
w2grAHIhvR9mztm6uXQlZhv1fu3P+RWHDSYhnZSCJSCdxPzQJ1mG5T5ahiL3HvCZ
|
44
|
+
2AC9FOGkybW6DJEFSFFMlNk0IILsa/gNp8ufGuTVLWF9FUUdMNK+TMbghnifT8/1
|
45
|
+
n+ES/gQPOnvmVkLDGw==
|
46
|
+
-----END CERTIFICATE-----
|
47
|
+
date: 2015-07-19 00:00:00.000000000 Z
|
48
|
+
dependencies:
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: minitest
|
51
|
+
requirement: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 5.7.0
|
56
|
+
- - "<"
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '6'
|
59
|
+
type: :development
|
60
|
+
prerelease: false
|
61
|
+
version_requirements: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 5.7.0
|
66
|
+
- - "<"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '6'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 10.4.2
|
76
|
+
- - "<"
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '11'
|
79
|
+
type: :development
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">"
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 10.4.2
|
86
|
+
- - "<"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '11'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: simplecov
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 0.10.0
|
96
|
+
- - "<"
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '2'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: 0.10.0
|
106
|
+
- - "<"
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '2'
|
109
|
+
- !ruby/object:Gem::Dependency
|
110
|
+
name: coveralls
|
111
|
+
requirement: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: 0.8.2
|
116
|
+
- - "<"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '2'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.8.2
|
126
|
+
- - "<"
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '2'
|
129
|
+
description: 'Provide Array #slice_by_share, #slice_by_size'
|
41
130
|
email: sixarm@sixarm.com
|
42
131
|
executables: []
|
43
132
|
extensions: []
|
44
133
|
extra_rdoc_files: []
|
45
134
|
files:
|
46
|
-
- .gemtest
|
47
135
|
- Rakefile
|
48
|
-
- README.md
|
49
|
-
- VERSION
|
50
136
|
- lib/sixarm_ruby_array_slice.rb
|
137
|
+
- lib/sixarm_ruby_array_slice/array.rb
|
51
138
|
- test/sixarm_ruby_array_slice_test.rb
|
139
|
+
- test/sixarm_ruby_array_slice_test/array_test.rb
|
52
140
|
homepage: http://sixarm.com/
|
53
|
-
licenses:
|
141
|
+
licenses:
|
142
|
+
- BSD
|
143
|
+
- GPL
|
144
|
+
- MIT
|
145
|
+
- PAL
|
146
|
+
- Various
|
147
|
+
metadata: {}
|
54
148
|
post_install_message:
|
55
149
|
rdoc_options: []
|
56
150
|
require_paths:
|
57
151
|
- lib
|
58
152
|
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
-
none: false
|
60
153
|
requirements:
|
61
|
-
- -
|
154
|
+
- - ">="
|
62
155
|
- !ruby/object:Gem::Version
|
63
156
|
version: '0'
|
64
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
158
|
requirements:
|
67
|
-
- -
|
159
|
+
- - ">="
|
68
160
|
- !ruby/object:Gem::Version
|
69
161
|
version: '0'
|
70
162
|
requirements: []
|
71
163
|
rubyforge_project:
|
72
|
-
rubygems_version:
|
164
|
+
rubygems_version: 2.4.8
|
73
165
|
signing_key:
|
74
|
-
specification_version:
|
166
|
+
specification_version: 4
|
75
167
|
summary: SixArm.com » Ruby » Array slice methods
|
76
168
|
test_files:
|
77
169
|
- test/sixarm_ruby_array_slice_test.rb
|
170
|
+
- test/sixarm_ruby_array_slice_test/array_test.rb
|
78
171
|
has_rdoc: true
|
metadata.gz.sig
CHANGED
Binary file
|
data/.gemtest
DELETED
File without changes
|
data/README.md
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
# SixArm.com » Ruby » <br> Array slice methods by size and share
|
2
|
-
|
3
|
-
* Docs: <http://sixarm.com/sixarm_ruby_array_slice/doc>
|
4
|
-
* Repo: <http://github.com/sixarm/sixarm_ruby_array_slice>
|
5
|
-
* Email: Joel Parker Henderson, <joel@sixarm.com>
|
6
|
-
|
7
|
-
|
8
|
-
## Introduction
|
9
|
-
|
10
|
-
Array slice methods:
|
11
|
-
|
12
|
-
* #slice_by_share: divides an array into a given number of slices
|
13
|
-
* #slice_by_size: divides an array into a slices of a given size
|
14
|
-
|
15
|
-
For docs go to <http://sixarm.com/sixarm_ruby_array_slice/doc>
|
16
|
-
|
17
|
-
Want to help? We're happy to get pull requests.
|
18
|
-
|
19
|
-
|
20
|
-
## Quickstart
|
21
|
-
|
22
|
-
Install:
|
23
|
-
|
24
|
-
gem install sixarm_ruby_array_slice
|
25
|
-
|
26
|
-
Bundler:
|
27
|
-
|
28
|
-
gem "sixarm_ruby_array_slice", "=2.1.4"
|
29
|
-
|
30
|
-
Require:
|
31
|
-
|
32
|
-
require "sixarm_ruby_array_slice"
|
33
|
-
|
34
|
-
|
35
|
-
## Example
|
36
|
-
|
37
|
-
Example of both ways to slice:
|
38
|
-
|
39
|
-
[1,2,3,4,5,6,7,8].slice_by_size(2)
|
40
|
-
=> [[1,2],[3,4],[5,6],[7,8]]
|
41
|
-
|
42
|
-
[1,2,3,4,5,6,7,8].slice_by_share(2)
|
43
|
-
=> [[1,2,3,4],[5,6,7,8]]
|
44
|
-
|
45
|
-
|
46
|
-
## Changes
|
47
|
-
|
48
|
-
* 2012-03-16 2.1.4 1.9.3; minitest/spec; update docs, tests.
|
49
|
-
* 2012-02-01 1.0.0 Publish.
|
50
|
-
|
51
|
-
|
52
|
-
## License
|
53
|
-
|
54
|
-
You may choose any of these open source licenses:
|
55
|
-
|
56
|
-
* Apache License
|
57
|
-
* BSD License
|
58
|
-
* CreativeCommons License, Non-commercial Share Alike
|
59
|
-
* GNU General Public License Version 2 (GPL 2)
|
60
|
-
* GNU Lesser General Public License (LGPL)
|
61
|
-
* MIT License
|
62
|
-
* Perl Artistic License
|
63
|
-
* Ruby License
|
64
|
-
|
65
|
-
The software is provided "as is", without warranty of any kind,
|
66
|
-
express or implied, including but not limited to the warranties of
|
67
|
-
merchantability, fitness for a particular purpose and noninfringement.
|
68
|
-
|
69
|
-
In no event shall the authors or copyright holders be liable for any
|
70
|
-
claim, damages or other liability, whether in an action of contract,
|
71
|
-
tort or otherwise, arising from, out of or in connection with the
|
72
|
-
software or the use or other dealings in the software.
|
73
|
-
|
74
|
-
This license is for the included software that is created by SixArm;
|
75
|
-
some of the included software may have its own licenses, copyrights,
|
76
|
-
authors, etc. and these do take precedence over the SixArm license.
|
77
|
-
|
78
|
-
Copyright (c) 2005-2013 Joel Parker Henderson
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.1.4
|