null_association 1.0.0.pre.rc.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +11 -6
- data/lib/null_association/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df1aea40cbaa84f084b9496ea365f88b740e39ea75b80275d061ec9abaa0cb8c
|
4
|
+
data.tar.gz: 3b4efa03752c5f71b1bbd2f22f3c6fb5ecdcf8d244b2c406a7d9ee6415e05102
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '02365904b42590f622b0c933c28c6580d9488d06c05c50b5830c318a76d51b3271bdc4092810ebc98cce8cefb68d0f2689cd359c697dadc8958b1645bff78e19'
|
7
|
+
data.tar.gz: 979e4b663c4facd667240d70b48b291ed8a4ef14a7763248da5018667f1af29cc01ba3420ef3f7a95ec87ecbf5fcafa08825858b73d872560ac833df5836a63f
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -41,13 +41,20 @@ $ gem install null_association
|
|
41
41
|
## Usage
|
42
42
|
|
43
43
|
To use a null object, define an optional singular association and use the
|
44
|
-
`null_object:` keyword, which accepts a class, a
|
45
|
-
the association is nil, the null object will be returned instead.
|
44
|
+
`null_object:` keyword, which accepts a class name, a class, or an instance.
|
45
|
+
When the association is nil, the null object will be returned instead.
|
46
46
|
|
47
47
|
```ruby
|
48
|
-
class
|
48
|
+
class NullObject
|
49
49
|
include Singleton
|
50
50
|
|
51
|
+
def present? = false
|
52
|
+
def blank? = true
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
class NullPlan < NullObject
|
51
58
|
def name = 'Free'
|
52
59
|
def free? = true
|
53
60
|
def pro? = false
|
@@ -56,9 +63,7 @@ end
|
|
56
63
|
```
|
57
64
|
|
58
65
|
```ruby
|
59
|
-
class NullBilling
|
60
|
-
include Singleton
|
61
|
-
|
66
|
+
class NullBilling < NullObject
|
62
67
|
def subscribed? = true
|
63
68
|
def trialing? = false
|
64
69
|
def canceled? = false
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: null_association
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zeke Gabrielse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -126,9 +126,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: '3.1'
|
127
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: '0'
|
132
132
|
requirements: []
|
133
133
|
rubygems_version: 3.4.13
|
134
134
|
signing_key:
|