Skip to content

Commit

Permalink
add null object to example
Browse files Browse the repository at this point in the history
  • Loading branch information
ezekg committed Aug 15, 2024
1 parent e9b4ad0 commit 800d567
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,16 @@ To use a null object, define an optional singular association and use the
the association is nil, the null object will be returned instead.

```ruby
class NullPlan
class NullObject
include Singleton

def present? = false
def blank? = true
end
```

```ruby
class NullPlan < NullObject
def name = 'Free'
def free? = true
def pro? = false
Expand All @@ -56,9 +63,7 @@ end
```

```ruby
class NullBilling
include Singleton

class NullBilling < NullObject
def subscribed? = true
def trialing? = false
def canceled? = false
Expand Down

0 comments on commit 800d567

Please sign in to comment.