not_nil 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +15 -0
  2. data/lib/not_nil.rb +8 -0
  3. data/spec/not_nil_spec.rb +30 -0
  4. metadata +60 -0
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ Nzk5MTNjYWRmY2EyYmFmMDhiMTEzZDcxZGI2ZWQ3YjdlNmRlOTRlYQ==
5
+ data.tar.gz: !binary |-
6
+ OTlkZjIyYTg0MWYzMTVlM2RlZDY1OWNlYTRhODU4MDAzY2IzYTVjYw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ Y2M5MWUzMzE4OGEzODE2OWI3N2FkZGMwZGZkN2I1YzZhYjliNjFkMDdlZmNm
10
+ OTBjYmEyZTIyZjAyMGI0OTYyYjVlNmVhNTk5ZThmMzJjMDFmMDE4ZDJkYWM3
11
+ MzQyOTcyYTEwMDI5YTllYzQ2ODc5ZTRlZDYwNmU5MjA4MTcyOWI=
12
+ data.tar.gz: !binary |-
13
+ YjZkODA4NjYyMjMwYmEwYjQ2NDE1ZjMzZWQyODRlNjQ1YWJmY2E0NzZlYmZh
14
+ YTJmNGE5M2JlMTU3ZTI5NjI2ZWE1Y2M3OGM5MmE1NWIyNDNlMGU4Zjc1YTMy
15
+ YmFiODM1YmFjZDE4Yzg4NTZhOTRmZmE5YmFmNjUxYjQ4MzIyMWE=
data/lib/not_nil.rb ADDED
@@ -0,0 +1,8 @@
1
+ module NotNil
2
+ def not_nil?
3
+ !nil?
4
+ end
5
+ end
6
+
7
+ Object.send(:extend, NotNil)
8
+ Object.send(:include, NotNil)
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe Object do
4
+ before(:each){
5
+ @a_nil_object = nil
6
+ @an_empty_object = Object.new
7
+ String.send(:define_method, :not_nil?){'I AM NOT NIL'}
8
+ @empty_string = String.new
9
+ }
10
+ context 'nil instance method' do
11
+ describe "nil class additions" do
12
+ it "responds to nil and not_nil" do
13
+ expect(@a_nil_object.methods.include? :not_nil?).to eq true
14
+ expect(@a_nil_object.nil?).to eq true
15
+ expect(@a_nil_object.not_nil?).to eq false
16
+ end
17
+ end
18
+ describe "object class additions" do
19
+ it "responds to nil and not_nil" do
20
+ expect(@an_empty_object.nil?).to eq false
21
+ expect(@an_empty_object.not_nil?).to eq true
22
+ end
23
+ end
24
+ describe "string" do
25
+ it "responds correctly to a redefined not_nil" do
26
+ expect(@empty_string.not_nil?).to eq "I AM NOT NIL"
27
+ end
28
+ end
29
+ end
30
+ end
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: not_nil
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Mark Platt
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec-rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: not_nil adds not_nil? to nil
28
+ email: mplatt@tammantech.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - lib/not_nil.rb
34
+ - spec/not_nil_spec.rb
35
+ homepage: http://tammantech.com
36
+ licenses:
37
+ - MIT
38
+ metadata: {}
39
+ post_install_message:
40
+ rdoc_options: []
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: 1.9.3
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ! '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ requirements: []
54
+ rubyforge_project:
55
+ rubygems_version: 2.0.7
56
+ signing_key:
57
+ specification_version: 4
58
+ summary: not_nil adds not_nil? to object.
59
+ test_files:
60
+ - spec/not_nil_spec.rb