extendomatic 0.2.2 → 0.2.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.
data/Manifest CHANGED
@@ -2,8 +2,10 @@ README
2
2
  Rakefile
3
3
  extendomatic.gemspec
4
4
  lib/extendomatic.rb
5
+ lib/extensions/array_extensions.rb
5
6
  lib/extensions/assertions_extensions.rb
6
7
  lib/extensions/enumerable_extensions.rb
8
+ lib/extensions/hash_extensions.rb
7
9
  lib/extensions/number_helper_extensions.rb
8
10
  lib/extensions/object_extensions.rb
9
11
  Manifest
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('extendomatic', '0.2.2') do |p|
5
+ Echoe.new('extendomatic', '0.2.3') do |p|
6
6
  p.description = "Mix in a bunch of crazy methods (like accumulate, not, and compact_blank)"
7
7
  p.url = "http://github.com/shipstar/extendomatic"
8
8
  p.author = "Kyle Shipley"
@@ -2,24 +2,23 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{extendomatic}
5
- s.version = "0.2.2"
5
+ s.version = "0.2.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Kyle Shipley"]
9
- s.date = %q{2010-10-28}
9
+ s.date = %q{2011-05-23}
10
10
  s.description = %q{Mix in a bunch of crazy methods (like accumulate, not, and compact_blank)}
11
11
  s.email = %q{shipstar@gmail.com}
12
- s.extra_rdoc_files = ["README", "extendomatic.gemspec", "lib/extendomatic.rb", "lib/extensions/assertions_extensions.rb", "lib/extensions/enumerable_extensions.rb", "lib/extensions/number_helper_extensions.rb", "lib/extensions/object_extensions.rb"]
13
- s.files = ["README", "Rakefile", "extendomatic.gemspec", "lib/extendomatic.rb", "lib/extensions/assertions_extensions.rb", "lib/extensions/enumerable_extensions.rb", "lib/extensions/number_helper_extensions.rb", "lib/extensions/object_extensions.rb", "Manifest"]
12
+ s.extra_rdoc_files = ["README", "extendomatic.gemspec", "lib/extendomatic.rb", "lib/extensions/array_extensions.rb", "lib/extensions/assertions_extensions.rb", "lib/extensions/enumerable_extensions.rb", "lib/extensions/hash_extensions.rb", "lib/extensions/number_helper_extensions.rb", "lib/extensions/object_extensions.rb"]
13
+ s.files = ["README", "Rakefile", "extendomatic.gemspec", "lib/extendomatic.rb", "lib/extensions/array_extensions.rb", "lib/extensions/assertions_extensions.rb", "lib/extensions/enumerable_extensions.rb", "lib/extensions/hash_extensions.rb", "lib/extensions/number_helper_extensions.rb", "lib/extensions/object_extensions.rb", "Manifest"]
14
14
  s.homepage = %q{http://github.com/shipstar/extendomatic}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Extendomatic", "--main", "README"]
16
16
  s.require_paths = ["lib"]
17
17
  s.rubyforge_project = %q{extendomatic}
18
- s.rubygems_version = %q{1.3.7}
18
+ s.rubygems_version = %q{1.4.2}
19
19
  s.summary = %q{Mix in a bunch of crazy methods (like accumulate, not, and compact_blank)}
20
20
 
21
21
  if s.respond_to? :specification_version then
22
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
23
22
  s.specification_version = 3
24
23
 
25
24
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
@@ -0,0 +1,22 @@
1
+ class Array
2
+ def compact_blank
3
+ reject{ |el| el.blank? }
4
+ end
5
+
6
+ # FROM ACTIVE SUPPORT 3
7
+ # Return an unique array based on the criteria given as a proc.
8
+ #
9
+ # [1, 2, 3, 4].uniq_by { |i| i.odd? }
10
+ # # => [1, 2]
11
+ #
12
+ def uniq_by
13
+ hash, array = {}, []
14
+ each { |i| hash[yield(i)] ||= (array << i) }
15
+ array
16
+ end
17
+
18
+ # Same as uniq_by, but modifies self.
19
+ def uniq_by!
20
+ replace(uniq_by{ |i| yield(i) })
21
+ end
22
+ end
@@ -1,11 +1,7 @@
1
1
  module Enumerable
2
- def compact_blank
3
- reject {|e| e.blank?}
4
- end
5
-
6
- def accumulate(initial, &block)
2
+ def accumulate(initial)
7
3
  inject(initial) do |memo, entry|
8
- block.call memo, entry
4
+ yield memo, entry
9
5
  memo
10
6
  end
11
7
  end
@@ -0,0 +1,5 @@
1
+ class Hash
2
+ def compact_blank
3
+ reject{ |k,v| v.blank? }
4
+ end
5
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: extendomatic
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 17
5
+ prerelease:
5
6
  segments:
6
7
  - 0
7
8
  - 2
8
- - 2
9
- version: 0.2.2
9
+ - 3
10
+ version: 0.2.3
10
11
  platform: ruby
11
12
  authors:
12
13
  - Kyle Shipley
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-10-28 00:00:00 -04:00
18
+ date: 2011-05-23 00:00:00 -04:00
18
19
  default_executable:
19
20
  dependencies: []
20
21
 
@@ -28,8 +29,10 @@ extra_rdoc_files:
28
29
  - README
29
30
  - extendomatic.gemspec
30
31
  - lib/extendomatic.rb
32
+ - lib/extensions/array_extensions.rb
31
33
  - lib/extensions/assertions_extensions.rb
32
34
  - lib/extensions/enumerable_extensions.rb
35
+ - lib/extensions/hash_extensions.rb
33
36
  - lib/extensions/number_helper_extensions.rb
34
37
  - lib/extensions/object_extensions.rb
35
38
  files:
@@ -37,8 +40,10 @@ files:
37
40
  - Rakefile
38
41
  - extendomatic.gemspec
39
42
  - lib/extendomatic.rb
43
+ - lib/extensions/array_extensions.rb
40
44
  - lib/extensions/assertions_extensions.rb
41
45
  - lib/extensions/enumerable_extensions.rb
46
+ - lib/extensions/hash_extensions.rb
42
47
  - lib/extensions/number_helper_extensions.rb
43
48
  - lib/extensions/object_extensions.rb
44
49
  - Manifest
@@ -61,6 +66,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
61
66
  requirements:
62
67
  - - ">="
63
68
  - !ruby/object:Gem::Version
69
+ hash: 3
64
70
  segments:
65
71
  - 0
66
72
  version: "0"
@@ -69,6 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
75
  requirements:
70
76
  - - ">="
71
77
  - !ruby/object:Gem::Version
78
+ hash: 11
72
79
  segments:
73
80
  - 1
74
81
  - 2
@@ -76,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
83
  requirements: []
77
84
 
78
85
  rubyforge_project: extendomatic
79
- rubygems_version: 1.3.7
86
+ rubygems_version: 1.4.2
80
87
  signing_key:
81
88
  specification_version: 3
82
89
  summary: Mix in a bunch of crazy methods (like accumulate, not, and compact_blank)