not_niller 0.0.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 20f59c77343002e304c578a06f897cbc6ddb062f3380fec4c141a3542ea7ee13
4
+ data.tar.gz: 6edeee7ede01b96d22cb26fd7ae3649325946b87d0a91a3acaea2fc15be0201f
5
+ SHA512:
6
+ metadata.gz: fede8d5175523ddbcb18f40077c72070156cea99da866f92cad963f0cafe10fca6b4b5c4d97eb02bce2ab6c595eb0de7e2291e959ea5fe4222dd55861dd34a5c
7
+ data.tar.gz: 3ea47d48ac94e48af47715a9e93746ee35e771fd807531bb06489520e7e03bf4aee742978a3452f0382da7fd2208656f9cf2fce320d423d2a020fc0b063a3f3f
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Adds to the root in order for all objects to respond to `not_nil?`
4
+ class Object
5
+ def not_nil?
6
+ !nil?
7
+ end
8
+ end
9
+
10
+ # Adds not_nil as a global method.
11
+ def not_nil
12
+ NotNilClass.instance
13
+ end
data/lib/not_niller.rb ADDED
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'singleton'
4
+
5
+ # Evil twin of NilClass
6
+ class NotNilClass
7
+ include Singleton
8
+
9
+ def ==(other)
10
+ !other.nil?
11
+ end
12
+
13
+ def inspect
14
+ 'not_nil'
15
+ end
16
+ end
17
+
18
+ require 'not_niller/object'
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: not_niller
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Payt devs
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-10-13 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - devs@paytsoftware.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/not_niller.rb
21
+ - lib/not_niller/object.rb
22
+ homepage:
23
+ licenses: []
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubygems_version: 3.1.6
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Add support for a not_nil type.
44
+ test_files: []