ignore_nil 1.0.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/.gitignore +12 -0
- data/VERSION +1 -0
- metadata +66 -0
data/.gitignore
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.3
|
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ignore_nil
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Steven Soroka
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-10-16 00:00:00 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: "\n The plugin is really rather simple; here's the ignore_nil method:\n\n def ignore_nil(&block)\n begin\n yield\n rescue NoMethodError, RuntimeError => e\n if (e.message =~ /You have a nil object when you didn't expect it/) ||\n (e.message =~ /undefined method `.*?' for nil:NilClass/) || (e.message =~ /^Called id for nil/)\n return nil\n else\n raise e\n end\n end\n end\n\n What's interesting about this is it catches both NoMethodError and RuntimeError, both of which\n can occur if a method unexpectedly returned nil and you called a method on it, but *ONLY* if\n the error message matches! This means legitimate NoMethodError and RuntimeError messages will\n not be bothered by ignore_nil, and will still raise in your application as you expect.\n\n I've used this in a production application since about mid/late 2008, I'd consider it very stable.\n Feedback welcome!\n "
|
17
|
+
email: ssoroka78@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- LICENSE
|
24
|
+
- README.rdoc
|
25
|
+
files:
|
26
|
+
- .gitignore
|
27
|
+
- LICENSE
|
28
|
+
- README.rdoc
|
29
|
+
- Rakefile
|
30
|
+
- VERSION
|
31
|
+
- ignore_nil.gemspec
|
32
|
+
- init.rb
|
33
|
+
- lib/ignore_nil.rb
|
34
|
+
- spec/ignore_nil_spec.rb
|
35
|
+
- spec/spec_helper.rb
|
36
|
+
has_rdoc: true
|
37
|
+
homepage: http://github.com/ssoroka/ignore_nil
|
38
|
+
licenses: []
|
39
|
+
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options:
|
42
|
+
- --charset=UTF-8
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: "0"
|
50
|
+
version:
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: "0"
|
56
|
+
version:
|
57
|
+
requirements: []
|
58
|
+
|
59
|
+
rubyforge_project:
|
60
|
+
rubygems_version: 1.3.5
|
61
|
+
signing_key:
|
62
|
+
specification_version: 3
|
63
|
+
summary: ignore_nil lets you happily ignore nil methods on long method chains. Keeps code pretty and much safer than "rescue nil", since it only catches NoMethodError on nil objects
|
64
|
+
test_files:
|
65
|
+
- spec/ignore_nil_spec.rb
|
66
|
+
- spec/spec_helper.rb
|