Class: Literal::NothingClass
- Defined in:
- lib/literal/nothing_class.rb
Overview
Note:
This class is not meant to be instantiated. You should use the Literal::Nothing
instance.
Instance Method Summary collapse
- #===(value) ⇒ Object
- #bind ⇒ Literal::Nothing
- #deconstruct ⇒ Object
- #deconstruct_keys(_) ⇒ Object
- #empty? ⇒ true
- #eql?(other) ⇒ Boolean
- #filter ⇒ Literal::Nothing
- #fmap ⇒ Literal::Nothing
-
#initialize ⇒ NothingClass
constructor
A new instance of NothingClass.
- #inspect ⇒ String
- #map(type = nil) ⇒ Literal::Nothing
- #nothing? ⇒ true
- #something? ⇒ false
- #then(type = nil) ⇒ Literal::Nothing
- #value_or ⇒ Object
Methods inherited from Maybe
Methods inherited from Monad
Constructor Details
#initialize ⇒ NothingClass
Returns a new instance of NothingClass.
5 6 7 |
# File 'lib/literal/nothing_class.rb', line 5 def initialize freeze end |
Instance Method Details
#===(value) ⇒ Object
38 39 40 |
# File 'lib/literal/nothing_class.rb', line 38 def ===(value) self == value end |
#deconstruct ⇒ Object
42 43 44 |
# File 'lib/literal/nothing_class.rb', line 42 def deconstruct [] end |
#deconstruct_keys(_) ⇒ Object
46 47 48 |
# File 'lib/literal/nothing_class.rb', line 46 def deconstruct_keys(_) {} end |
#empty? ⇒ true
13 |
# File 'lib/literal/nothing_class.rb', line 13 def empty? = true |
#eql?(other) ⇒ Boolean
50 51 52 |
# File 'lib/literal/nothing_class.rb', line 50 def eql?(other) Literal::Nothing == other end |
#inspect ⇒ String
10 |
# File 'lib/literal/nothing_class.rb', line 10 def inspect = "Literal::Nothing" |
#map(type = nil) ⇒ Literal::Nothing
27 |
# File 'lib/literal/nothing_class.rb', line 27 def map(type = nil) = self |
#nothing? ⇒ true
16 |
# File 'lib/literal/nothing_class.rb', line 16 def nothing? = true |
#something? ⇒ false
19 |
# File 'lib/literal/nothing_class.rb', line 19 def something? = false |
#then(type = nil) ⇒ Literal::Nothing
30 |
# File 'lib/literal/nothing_class.rb', line 30 def then(type = nil) = self |
#value_or ⇒ Object
21 |
# File 'lib/literal/nothing_class.rb', line 21 def value_or = yield |