sugar-high 0.2.12 → 0.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
- 0.2.12
1
+ 0.3.0
@@ -13,10 +13,18 @@ class Array
13
13
 
14
14
  def none?
15
15
  self.flatten.compact.empty?
16
- end
16
+ end
17
+
18
+ def flat_uniq
19
+ self.flatten.compact.uniq
20
+ end
17
21
  end
18
22
 
19
- class NilClass
23
+ class NilClass
24
+ def flat_uniq
25
+ []
26
+ end
27
+
20
28
  def none?
21
29
  true
22
30
  end
@@ -2,7 +2,6 @@ require 'active_support/inflector'
2
2
 
3
3
  class Module
4
4
  def last_name
5
- # name.gsub /^(.*)::/, ''
6
5
  name.demodulize
7
6
  end
8
7
  alias_method :demodulize, :last_name
@@ -23,6 +23,16 @@ describe "SugarHigh" do
23
23
  end
24
24
  end
25
25
 
26
+ describe '#flat_uniq' do
27
+ it "should flatten array, remove nils and make unique" do
28
+ [1, 'blip', ['blip', nil, 'c'], nil].flat_uniq.should == [1, 'blip', 'c']
29
+ end
30
+
31
+ it "should return empty list if called on nil" do
32
+ nil.flat_uniq.should == []
33
+ end
34
+ end
35
+
26
36
  describe '#none?' do
27
37
  it "should be none if no real values in array" do
28
38
  [nil, nil].none?.should be_true
data/sugar-high.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sugar-high}
8
- s.version = "0.2.12"
8
+ s.version = "0.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 = ["Kristian Mandrup"]
12
- s.date = %q{2010-10-07}
12
+ s.date = %q{2010-10-21}
13
13
  s.description = %q{More Ruby sugar - inspired by the 'zuker' project}
14
14
  s.email = %q{kmandrup@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
8
- - 12
9
- version: 0.2.12
7
+ - 3
8
+ - 0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kristian Mandrup
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-07 00:00:00 +02:00
17
+ date: 2010-10-21 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency