guerrilla_patch 2.6.1 → 2.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/guerrilla_patch.gemspec +2 -2
- data/lib/guerrilla_patch/allocate.rb +2 -2
- data/lib/guerrilla_patch/kernel.rb +1 -1
- data/spec/guerrilla_patch/kernel_spec.rb +3 -3
- data/spec/guerrilla_patch/string_spec.rb +9 -0
- metadata +11 -11
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.6.
|
1
|
+
2.6.2
|
data/guerrilla_patch.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "guerrilla_patch"
|
8
|
-
s.version = "2.6.
|
8
|
+
s.version = "2.6.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["drKreso"]
|
12
|
-
s.date = "2012-06-
|
12
|
+
s.date = "2012-06-19"
|
13
13
|
s.description = "I am tierd of hunting down monkey patches at large. Caging them inside this gem"
|
14
14
|
s.email = "kresimir.bojcic@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -8,13 +8,13 @@ class Allocate
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def divided
|
11
|
-
divided_ratios = @ratios.map { |ratio| ratio.to_d/ratios.
|
11
|
+
divided_ratios = @ratios.map { |ratio| ratio.to_d/ratios.sum_me.to_d }
|
12
12
|
compensate_last_slice( divided_ratios.map { |ratio| (@amount * ratio).round(2) } )
|
13
13
|
end
|
14
14
|
|
15
15
|
def compensate_last_slice(rates)
|
16
16
|
rates.tap do |rates|
|
17
|
-
rates[-1] = rates[-1] + (amount - rates.
|
17
|
+
rates[-1] = rates[-1] + (amount - rates.sum_me).round(2)
|
18
18
|
if ( amount > 0 && ( rates.select {|item| item <= 0 }.count > 0 ) ) ||
|
19
19
|
( amount < 0 && ( rates.select {|item| item >= 0 }.count > 0 ) )
|
20
20
|
raise "Number is too small to be allocated on that number of slices(#@amount on #{@ratios.size} slices)."
|
@@ -77,17 +77,17 @@ end
|
|
77
77
|
|
78
78
|
describe Array do
|
79
79
|
it 'should know how to sum basic array' do
|
80
|
-
[1,2,3].
|
80
|
+
[1,2,3].sum_me.should == 6
|
81
81
|
end
|
82
82
|
|
83
83
|
it 'should handle the zero elements case' do
|
84
|
-
[].
|
84
|
+
[].sum_me.should == 0
|
85
85
|
end
|
86
86
|
|
87
87
|
it 'can sum by name' do
|
88
88
|
apple = stub(:price => 100)
|
89
89
|
orange = stub(:price => 200)
|
90
|
-
[apple, orange].
|
90
|
+
[apple, orange].sum_me(:price).should == 300
|
91
91
|
end
|
92
92
|
|
93
93
|
end
|
@@ -30,6 +30,15 @@ describe String do
|
|
30
30
|
'mile_xX'.upcase_roman.should == 'mile_XX'
|
31
31
|
end
|
32
32
|
|
33
|
+
it 'knows how to upcase roman ii' do
|
34
|
+
'mili_Ii'.upcase_roman.should == 'mili_II'
|
35
|
+
'mili_ii'.upcase_roman.should == 'mili_II'
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should not upcase if not _' do
|
39
|
+
'mili'.upcase_roman.should == 'mili'
|
40
|
+
end
|
41
|
+
|
33
42
|
it 'should know to indent' do
|
34
43
|
a = " kreso\n subitem\n peer\n"
|
35
44
|
a.indent.should == "kreso\n subitem\npeer\n"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guerrilla_patch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-19 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70182464753040 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.8.0
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70182464753040
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bundler
|
27
|
-
requirement: &
|
27
|
+
requirement: &70182464750800 !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: *
|
35
|
+
version_requirements: *70182464750800
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: jeweler
|
38
|
-
requirement: &
|
38
|
+
requirement: &70182464749080 !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: *
|
46
|
+
version_requirements: *70182464749080
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rcov
|
49
|
-
requirement: &
|
49
|
+
requirement: &70182464746000 !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: *
|
57
|
+
version_requirements: *70182464746000
|
58
58
|
description: I am tierd of hunting down monkey patches at large. Caging them inside
|
59
59
|
this gem
|
60
60
|
email: kresimir.bojcic@gmail.com
|
@@ -95,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
95
95
|
version: '0'
|
96
96
|
segments:
|
97
97
|
- 0
|
98
|
-
hash:
|
98
|
+
hash: -114810608691283107
|
99
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
100
|
none: false
|
101
101
|
requirements:
|