nullobject 0.0.3 → 0.0.4

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/README.md CHANGED
@@ -5,10 +5,10 @@
5
5
 
6
6
  The intent of a Null Object is to encapsulate the absence of an object by providing a substitutable alternative that offers suitable default do nothing behavior. In short, a design where “nothing will come of nothing”
7
7
 
8
- More about Null Object Pattern you can find here:
9
- [http://en.wikipedia.org/wiki/Null_Object_pattern](http://en.wikipedia.org/wiki/Null_Object_pattern)
10
- [http://sourcemaking.com/design_patterns/null_object](http://sourcemaking.com/design_patterns/null_object)
11
- [http://avdi.org/devblog/2011/05/30/null-objects-and-falsiness](http://avdi.org/devblog/2011/05/30/null-objects-and-falsiness/)
8
+ More about Null Object Pattern you can find here:
9
+ [http://en.wikipedia.org/wiki/Null_Object_pattern](http://en.wikipedia.org/wiki/Null_Object_pattern)
10
+ [http://sourcemaking.com/design_patterns/null_object](http://sourcemaking.com/design_patterns/null_object)
11
+ [http://avdi.org/devblog/2011/05/30/null-objects-and-falsiness](http://avdi.org/devblog/2011/05/30/null-objects-and-falsiness/)
12
12
 
13
13
  ## Usage
14
14
 
@@ -28,7 +28,7 @@ More about Null Object Pattern you can find here:
28
28
  end
29
29
 
30
30
  h = {}
31
-
31
+
32
32
  slug(h[:missing_key]) # => ""
33
33
 
34
34
  foo = Null::Object.instance
@@ -52,7 +52,7 @@ More about Null Object Pattern you can find here:
52
52
  foo = FooNullObject.instance
53
53
  foo.to_bar # => "nothing here"
54
54
  foo.to_s # => ""
55
-
55
+
56
56
  ## Setup
57
57
 
58
58
  If you are using bundler add nullobject to your Gemfile:
@@ -90,4 +90,4 @@ Tests can be ran with `rake test`
90
90
 
91
91
  ## Copyright
92
92
 
93
- Copyright (c) 2011 Marcin Ciunelis. See [LICENSE](https://github.com/martinciu/nullobject/blob/master/LICENSE) for details.
93
+ Copyright (c) 2012 Marcin Ciunelis. See [LICENSE](https://github.com/martinciu/nullobject/blob/master/LICENSE) for details.
@@ -20,6 +20,10 @@ module Null
20
20
  self
21
21
  end
22
22
 
23
+ def respond_to?(message, include_private=false)
24
+ true
25
+ end
26
+
23
27
  class Object
24
28
  include Null
25
29
  end
@@ -1,3 +1,3 @@
1
1
  module Nullobject
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "Null::Object" do
4
-
4
+
5
5
  describe "instance methods" do
6
6
  before do
7
7
  @it = Null::Object.instance
@@ -30,6 +30,14 @@ describe "Null::Object" do
30
30
  it "#inspect is meaningful" do
31
31
  @it.inspect.wont_be_empty
32
32
  end
33
+
34
+ it "responds to everything" do
35
+ @it.respond_to?(:everything).must_equal true
36
+ end
37
+
38
+ it "responds with self" do
39
+ @it.foo.must_equal @it
40
+ end
33
41
  end
34
42
 
35
43
  describe "custom null" do
@@ -68,7 +76,7 @@ describe "Null::Object" do
68
76
  it "#to_bar returns 'nothing_here'" do
69
77
  @it.to_bar.must_equal "nothing here"
70
78
  end
71
-
79
+
72
80
  end
73
81
 
74
82
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nullobject
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-28 00:00:00.000000000 Z
12
+ date: 2012-11-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -91,7 +91,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
91
  version: '0'
92
92
  segments:
93
93
  - 0
94
- hash: 1557396206917223491
94
+ hash: -2796458509654921624
95
95
  required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  none: false
97
97
  requirements:
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  version: '0'
101
101
  segments:
102
102
  - 0
103
- hash: 1557396206917223491
103
+ hash: -2796458509654921624
104
104
  requirements: []
105
105
  rubyforge_project:
106
106
  rubygems_version: 1.8.24