weesked 0.0.2 → 0.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7692d56d4dfcfcd343bf0c41df26e7fe8f12275d
|
4
|
+
data.tar.gz: eaa41253e3f5debb69804fd5b6405aef8a71f036
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ea336c5b2ad8561e3f72f4489519854e9e0685739558f6deaef6bdb2357d755f073fa3d1db33a035b8e74b71f81f3ef1ddcc369ae86a1ba91dcac72275d8e99
|
7
|
+
data.tar.gz: 09280382680502941934014a7fee4aa70a466d7a8df3757938c1921a72f4feb8450c43c3e413bacbf6080458adbd713699151f753684b437d97b056fbffe80c2
|
@@ -9,7 +9,8 @@ module Weesked
|
|
9
9
|
|
10
10
|
def to_a
|
11
11
|
return ary if ary.length == 0 || offset == 0
|
12
|
-
ary.
|
12
|
+
shift_offset = ary.take_while {|n| n < offset}.length
|
13
|
+
ary.push(ary.shift(shift_offset)).flatten
|
13
14
|
end
|
14
15
|
|
15
16
|
def to_range
|
@@ -50,4 +51,4 @@ module Weesked
|
|
50
51
|
|
51
52
|
end
|
52
53
|
|
53
|
-
end
|
54
|
+
end
|
data/lib/weesked/version.rb
CHANGED
@@ -5,12 +5,15 @@ module Weesked
|
|
5
5
|
|
6
6
|
let(:input) { [0, 1, 13, 14, 15, 21, 22, 23] }
|
7
7
|
let(:input2) { [1, 2, 3, 13, 14, 15, 21, 22, 23] }
|
8
|
+
let(:input3) { [1, 2, 10, 11, 12, 17, 19, 21, 23] }
|
8
9
|
let(:offset) { 2 }
|
9
|
-
let(:offset2) {
|
10
|
+
let(:offset2) { 4 }
|
11
|
+
let(:offset3) { 4 }
|
10
12
|
|
11
13
|
describe '#offset' do
|
12
14
|
let(:output) { [13, 14, 15, 21, 22, 23, 0, 1] }
|
13
15
|
let(:output2) { [13, 14, 15, 21, 22, 23, 1, 2, 3] }
|
16
|
+
let(:output3) { [10, 11, 12, 17, 19, 21, 23, 1, 2] }
|
14
17
|
subject { OffsetHandler.new(input, offset).to_a }
|
15
18
|
it 'returns same array if input empty or offset in zero' do
|
16
19
|
OffsetHandler.new.to_a.must_equal []
|
@@ -22,11 +25,15 @@ module Weesked
|
|
22
25
|
it 'returns array with offset' do
|
23
26
|
OffsetHandler.new(input2, offset2).to_a.must_equal output2
|
24
27
|
end
|
28
|
+
it 'returns array with offset' do
|
29
|
+
OffsetHandler.new(input3, offset3).to_a.must_equal output3
|
30
|
+
end
|
25
31
|
end
|
26
32
|
|
27
33
|
describe '#to_range' do
|
28
34
|
let(:output) { [13..15, 21..1] }
|
29
35
|
let(:output2) { [13..15, 21..23, 1..3] }
|
36
|
+
let(:output3) { [10..12, 17..17, 19..19, 21..21, 23..23, 1..2] }
|
30
37
|
subject { OffsetHandler.new(input, offset).to_range }
|
31
38
|
it 'returns array with ranges' do
|
32
39
|
subject.must_equal output
|
@@ -34,6 +41,9 @@ module Weesked
|
|
34
41
|
it 'returns array with ranges' do
|
35
42
|
(OffsetHandler.new(input2, offset2).to_range).must_equal output2
|
36
43
|
end
|
44
|
+
it 'returns array with ranges' do
|
45
|
+
(OffsetHandler.new(input3, offset3).to_range).must_equal output3
|
46
|
+
end
|
37
47
|
end
|
38
48
|
end
|
39
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weesked
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Davydov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -92,7 +92,7 @@ files:
|
|
92
92
|
- test/weesked/configuration_test.rb
|
93
93
|
- test/weesked/day_bulder_test.rb
|
94
94
|
- test/weesked/day_test.rb
|
95
|
-
- test/weesked/
|
95
|
+
- test/weesked/offset_handler_test.rb
|
96
96
|
- test/weesked/schedule_test.rb
|
97
97
|
- test/weesked_test.rb
|
98
98
|
- weesked.gemspec
|
@@ -126,6 +126,6 @@ test_files:
|
|
126
126
|
- test/weesked/configuration_test.rb
|
127
127
|
- test/weesked/day_bulder_test.rb
|
128
128
|
- test/weesked/day_test.rb
|
129
|
-
- test/weesked/
|
129
|
+
- test/weesked/offset_handler_test.rb
|
130
130
|
- test/weesked/schedule_test.rb
|
131
131
|
- test/weesked_test.rb
|