guerrilla_patch 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.2.0
1
+ 2.3.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "guerrilla_patch"
8
- s.version = "2.2.0"
8
+ s.version = "2.3.0"
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-03-04"
12
+ s.date = "2012-03-30"
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 = [
@@ -35,7 +35,7 @@ Gem::Specification.new do |s|
35
35
  s.homepage = "http://github.com/drkreso/guerrilla_patch"
36
36
  s.licenses = ["MIT"]
37
37
  s.require_paths = ["lib"]
38
- s.rubygems_version = "1.8.10"
38
+ s.rubygems_version = "1.8.17"
39
39
  s.summary = "Collection of monkey patches"
40
40
 
41
41
  if s.respond_to? :specification_version then
@@ -1,44 +1,56 @@
1
1
  module Kernel
2
- def let(name, &block)
3
- define_method(name, &block)
4
- end
5
-
6
- def let_self(name, &block)
7
- define_singleton_method(name, &block)
8
- end
9
-
10
- def when_present(item, &block)
11
- if block_given?
12
- item.nil? ? '' : block.call(item)
13
- else
14
- item
15
- end
16
- end
17
-
18
- def consists_of
19
- PoorsManStringBuilder.new.tap { |builder| yield(builder) }.result
20
- end
21
-
22
- class PoorsManStringBuilder
23
- attr_reader :result
24
-
25
- def initialize
26
- @result = ''
27
- end
28
-
29
- def add(item)
30
- @result << item.to_s
31
- end
32
- alias :always :add
33
-
34
- def when_present(item, &block)
35
- @result << Kernel.when_present(item, &block).to_s
36
- end
37
-
38
- def when(item, &block)
39
- return unless item
40
- @result << Kernel.when_present(item, &block).to_s
41
- end
42
- end
2
+ def let(name, &block)
3
+ define_method(name, &block)
4
+ end
5
+
6
+ def let_self(name, &block)
7
+ define_singleton_method(name, &block)
8
+ end
9
+
10
+ def when_present(item, &block)
11
+ if block_given?
12
+ item.nil? ? '' : block.call(item)
13
+ else
14
+ item
15
+ end
16
+ end
17
+
18
+ def consists_of
19
+ PoorsManStringBuilder.new.tap { |builder| yield(builder) }.result
20
+ end
21
+
22
+ class PoorsManStringBuilder
23
+ attr_reader :result
24
+
25
+ def initialize
26
+ @result = ''
27
+ end
28
+
29
+ def add(item)
30
+ @result << item.to_s
31
+ end
32
+ alias :always :add
33
+
34
+ def when_present(item, &block)
35
+ @result << Kernel.when_present(item, &block).to_s
36
+ end
37
+
38
+ def when(item, &block)
39
+ return unless item
40
+ @result << Kernel.when_present(item, &block).to_s
41
+ end
42
+ end
43
+
44
+
45
+ #add sum to array, with or without name
46
+ class Array
47
+ def sum
48
+ self.reduce(0, :+)
49
+ end
50
+
51
+ def sum(name)
52
+ self.map(&name).reduce(0, :+)
53
+ end
54
+ end
43
55
 
44
56
  end
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.2.0
4
+ version: 2.3.0
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-03-04 00:00:00.000000000Z
12
+ date: 2012-03-30 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70320037889320 !ruby/object:Gem::Requirement
16
+ requirement: &70175837289120 !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: *70320037889320
24
+ version_requirements: *70175837289120
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &70320037887600 !ruby/object:Gem::Requirement
27
+ requirement: &70175837288240 !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: *70320037887600
35
+ version_requirements: *70175837288240
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: jeweler
38
- requirement: &70320037886140 !ruby/object:Gem::Requirement
38
+ requirement: &70175837287740 !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: *70320037886140
46
+ version_requirements: *70175837287740
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rcov
49
- requirement: &70320037885360 !ruby/object:Gem::Requirement
49
+ requirement: &70175837287240 !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: *70320037885360
57
+ version_requirements: *70175837287240
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
@@ -93,7 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
93
  version: '0'
94
94
  segments:
95
95
  - 0
96
- hash: -2181980295743074825
96
+ hash: -165187637556337306
97
97
  required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  none: false
99
99
  requirements:
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  version: '0'
103
103
  requirements: []
104
104
  rubyforge_project:
105
- rubygems_version: 1.8.10
105
+ rubygems_version: 1.8.17
106
106
  signing_key:
107
107
  specification_version: 3
108
108
  summary: Collection of monkey patches