ranges_merger 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -4,6 +4,9 @@ module RangesMergerDividerEqInterval
4
4
  # calculate for whole range
5
5
  joined_array = merge(_array)
6
6
 
7
+ # anti-nuke
8
+ return [] if joined_array.size == 0 or joined_array.nil?
9
+
7
10
  min = joined_array.first[0]
8
11
  min = total_min if total_min < min and not total_min.nil? # before merging
9
12
  max = joined_array.last[1]
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "ranges_merger"
8
- s.version = "0.4.1"
8
+ s.version = "0.4.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Aleksander Kwiatkowski"]
@@ -35,8 +35,8 @@ Gem::Specification.new do |s|
35
35
  "lib/ranges_merger/ranges_merger_utils.rb",
36
36
  "ranges_merger.gemspec",
37
37
  "spec/ranges_merger_energy_calculation_spec.rb",
38
+ "spec/ranges_merger_equal_interval_spec.rb",
38
39
  "spec/ranges_merger_spec.rb",
39
- "spec/ranges_merger_spec_equal_interval.rb",
40
40
  "spec/spec_helper.rb"
41
41
  ]
42
42
  s.homepage = "http://github.com/akwiatkowski/ranges_merger"
@@ -26,6 +26,12 @@ describe RangesMergerDividerEqInterval do
26
26
  result.should == [[2, 4], [6, 8]]
27
27
  end
28
28
 
29
+ it "should not nuke world when range is empty" do
30
+ r = RangesMerger.new
31
+ result = r.divide_eqi(2)
32
+ result.should == []
33
+ end
34
+
29
35
  it 'readme' do
30
36
  r = RangesMerger.new
31
37
  r += [[1, 9]]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ranges_merger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-08-06 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &12681880 !ruby/object:Gem::Requirement
16
+ requirement: &25546860 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.3.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *12681880
24
+ version_requirements: *25546860
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &13765160 !ruby/object:Gem::Requirement
27
+ requirement: &25548300 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *13765160
35
+ version_requirements: *25548300
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: jeweler
38
- requirement: &14139740 !ruby/object:Gem::Requirement
38
+ requirement: &25649060 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.6.4
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *14139740
46
+ version_requirements: *25649060
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rcov
49
- requirement: &15781800 !ruby/object:Gem::Requirement
49
+ requirement: &27299880 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *15781800
57
+ version_requirements: *27299880
58
58
  description: Simple gem used for merging range-like objects. If you have problems
59
59
  with operations on ranges this gem can save you some time.
60
60
  email: bobikx@poczta.fm
@@ -82,8 +82,8 @@ files:
82
82
  - lib/ranges_merger/ranges_merger_utils.rb
83
83
  - ranges_merger.gemspec
84
84
  - spec/ranges_merger_energy_calculation_spec.rb
85
+ - spec/ranges_merger_equal_interval_spec.rb
85
86
  - spec/ranges_merger_spec.rb
86
- - spec/ranges_merger_spec_equal_interval.rb
87
87
  - spec/spec_helper.rb
88
88
  homepage: http://github.com/akwiatkowski/ranges_merger
89
89
  licenses:
@@ -100,7 +100,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
100
  version: '0'
101
101
  segments:
102
102
  - 0
103
- hash: 1390856309896833355
103
+ hash: -3958858860347898875
104
104
  required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements: