maybelline 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Maybelline
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
data/lib/maybelline.rb CHANGED
@@ -18,6 +18,8 @@ module Maybelline
18
18
 
19
19
  def initialize(object)
20
20
  @__object__ = object
21
+
22
+ ::Object.new.send :throw, :nothing if @__object__.nil?
21
23
  end
22
24
 
23
25
  def method_missing(method, *args)
@@ -18,6 +18,10 @@ describe Maybelline::Maybe do
18
18
  expect{subject.i_wanna_nil}.to throw_symbol
19
19
  end
20
20
 
21
+ it "should thow :nothing if initialized with nil" do
22
+ expect{Maybelline::Maybe.new(nil)}.to throw_symbol
23
+ end
24
+
21
25
  it "should expose the internal object with __object__" do
22
26
  subject.__object__.should == object
23
27
  end
@@ -40,6 +44,12 @@ describe "#Maybe" do
40
44
  result = Maybe(object){|o| o.rob.bob.jack}
41
45
  result.should == 1
42
46
  end
47
+
48
+ it "should not call the block when called when nil is passed" do
49
+ executed = false
50
+ Maybe(nil){executed = true}
51
+ executed.should be_false
52
+ end
43
53
  end
44
54
 
45
55
  describe "#maybe" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maybelline
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-06-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70244550945600 !ruby/object:Gem::Requirement
16
+ requirement: &70102062050120 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70244550945600
24
+ version_requirements: *70102062050120
25
25
  description: Maybe you should start using the maybe monad, stop checking for nil,
26
26
  and be confident
27
27
  email: