null_plus 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +5 -1
- data/Gemfile +1 -0
- data/MIT-LICENSE.txt +1 -1
- data/README.md +6 -6
- data/Rakefile +15 -1
- data/lib/null_plus/version.rb +3 -2
- data/null_plus.gemspec +2 -2
- metadata +5 -8
- data/.travis.yml +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ac6e13040abaa45772195cb41646fe72cf118528a9bd1b259762a5b1389ab443
|
4
|
+
data.tar.gz: 9946e95dd4672c24d9bb68e65dccb919197f8b10e33832ad6cedd463f91922b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4eb5b9b394663c137b667cd59bfa291132cf25d4a94c916b8ff8bd7e6bbb1033cadefa66a15732f8b8723c151934b4fe09c6743239d9002664942ef41e970894
|
7
|
+
data.tar.gz: 90f63600dd406a170aee9bcb1fa5ac399613967c0f9b50b3e26a4c07d99718e1d6f334ed326aa7f89427cedb822fbf7720e716358ca58d00531275cd5a5d637f
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/MIT-LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
#
|
1
|
+
# +`nil` [![[version]](https://badge.fury.io/rb/null_plus.svg)](https://badge.fury.io/rb/null_plus) [![[ci]](https://github.com/janlelis/null_plus/workflows/Test/badge.svg)](https://github.com/janlelis/null_plus/actions?query=workflow%3ATest)
|
2
2
|
|
3
|
-
This gem redefines Ruby's unary `+` operator to turn null objects into nil. By default, the unary `+` operator is
|
3
|
+
This gem redefines Ruby's unary `+` operator to turn null objects into nil. By default, the unary `+` operator is rarely¹ used by Ruby, so overloading it is not so dangerous as it might have sounded to you when you read it.
|
4
4
|
|
5
5
|
Every object that returns [true for `null?`](https://github.com/janlelis/null_question) is considered a null object.
|
6
6
|
|
7
|
+
¹ (Ruby 2.3 introduced `+` for String: It will return an unfrozen version of the string)
|
7
8
|
|
8
9
|
## Setup
|
9
10
|
|
@@ -13,19 +14,18 @@ Add to your **Gemfile**:
|
|
13
14
|
gem "null_plus"
|
14
15
|
```
|
15
16
|
|
16
|
-
|
17
17
|
## Usage
|
18
18
|
|
19
19
|
```ruby
|
20
20
|
class NullObject
|
21
21
|
def null?
|
22
22
|
true
|
23
|
-
end
|
23
|
+
end
|
24
24
|
end
|
25
25
|
|
26
26
|
null = NullObject.new
|
27
27
|
|
28
|
-
+nil #=> nil
|
28
|
+
+nil #=> nil
|
29
29
|
+null #=> nil
|
30
30
|
+"some object" #=> "some object"
|
31
31
|
|
@@ -57,4 +57,4 @@ null = NullObject.new
|
|
57
57
|
|
58
58
|
## J-_-L
|
59
59
|
|
60
|
-
Copyright (C) 2015 Jan Lelis <
|
60
|
+
Copyright (C) 2015 Jan Lelis <https://janlelis.com>. Released under the MIT license.
|
data/Rakefile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# # #
|
2
2
|
# Get gemspec info
|
3
3
|
|
4
|
-
gemspec_file = Dir['*.gemspec'].first
|
4
|
+
gemspec_file = Dir['*.gemspec'].first
|
5
5
|
gemspec = eval File.read(gemspec_file), binding, gemspec_file
|
6
6
|
info = "#{gemspec.name} | #{gemspec.version} | " \
|
7
7
|
"#{gemspec.runtime_dependencies.size} dependencies | " \
|
@@ -28,3 +28,17 @@ desc "#{gemspec.name} | IRB"
|
|
28
28
|
task :irb do
|
29
29
|
sh "irb -I ./lib -r #{gemspec.name.gsub '-','/'}"
|
30
30
|
end
|
31
|
+
|
32
|
+
|
33
|
+
# # #
|
34
|
+
# Run specs
|
35
|
+
|
36
|
+
desc "#{gemspec.name} | Spec"
|
37
|
+
task :spec do
|
38
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
|
39
|
+
sh "for %f in (spec/\*.rb) do ruby spec/%f"
|
40
|
+
else
|
41
|
+
sh "for file in spec/*.rb; do ruby $file; done"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
task default: :spec
|
data/lib/null_plus/version.rb
CHANGED
data/null_plus.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.summary = "+nil"
|
9
9
|
gem.description = "This gem redefines Ruby's unary + operator to turn null objects into nil. By default, the unary + operator is not used by Ruby, so overloading it is not so dangerous as it might have sounded to you when you read it. Every object that returns true for null? is considered a null object."
|
10
10
|
gem.authors = ["Jan Lelis"]
|
11
|
-
gem.email = ["
|
11
|
+
gem.email = ["hi@ruby.consulting"]
|
12
12
|
gem.homepage = "https://github.com/janlelis/null_plus"
|
13
13
|
gem.license = "MIT"
|
14
14
|
|
@@ -17,6 +17,6 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
20
|
-
gem.required_ruby_version = "
|
20
|
+
gem.required_ruby_version = ">= 2.0"
|
21
21
|
gem.add_dependency "null_question", "~> 1.0"
|
22
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: null_plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Lelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: null_question
|
@@ -29,13 +29,12 @@ description: This gem redefines Ruby's unary + operator to turn null objects int
|
|
29
29
|
not so dangerous as it might have sounded to you when you read it. Every object
|
30
30
|
that returns true for null? is considered a null object.
|
31
31
|
email:
|
32
|
-
-
|
32
|
+
- hi@ruby.consulting
|
33
33
|
executables: []
|
34
34
|
extensions: []
|
35
35
|
extra_rdoc_files: []
|
36
36
|
files:
|
37
37
|
- ".gitignore"
|
38
|
-
- ".travis.yml"
|
39
38
|
- CHANGELOG.md
|
40
39
|
- Gemfile
|
41
40
|
- MIT-LICENSE.txt
|
@@ -55,7 +54,7 @@ require_paths:
|
|
55
54
|
- lib
|
56
55
|
required_ruby_version: !ruby/object:Gem::Requirement
|
57
56
|
requirements:
|
58
|
-
- - "
|
57
|
+
- - ">="
|
59
58
|
- !ruby/object:Gem::Version
|
60
59
|
version: '2.0'
|
61
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
@@ -64,11 +63,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
63
|
- !ruby/object:Gem::Version
|
65
64
|
version: '0'
|
66
65
|
requirements: []
|
67
|
-
|
68
|
-
rubygems_version: 2.4.6
|
66
|
+
rubygems_version: 3.2.4
|
69
67
|
signing_key:
|
70
68
|
specification_version: 4
|
71
69
|
summary: "+nil"
|
72
70
|
test_files:
|
73
71
|
- spec/null_plus_spec.rb
|
74
|
-
has_rdoc:
|
data/.travis.yml
DELETED