Class: RFunk::None
- Inherits:
-
Option
show all
- Includes:
- Singleton
- Defined in:
- lib/rfunk/maybe/none.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Option
inherited
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(_method, *_arguments, &_block) ⇒ Object
33
34
35
|
# File 'lib/rfunk/maybe/none.rb', line 33
def method_missing(_method, *_arguments, &_block)
self
end
|
Class Method Details
.create(_) ⇒ Object
6
7
8
|
# File 'lib/rfunk/maybe/none.rb', line 6
def create(_)
instance
end
|
.satisfies?(value) ⇒ Boolean
10
11
12
|
# File 'lib/rfunk/maybe/none.rb', line 10
def satisfies?(value)
value.nil? || empty?(value)
end
|
Instance Method Details
#coerce(other) ⇒ Object
37
38
39
|
# File 'lib/rfunk/maybe/none.rb', line 37
def coerce(other)
[other, 0]
end
|
#key ⇒ Object
53
54
55
|
# File 'lib/rfunk/maybe/none.rb', line 53
def key
:none
end
|
#or(other) ⇒ Object
25
26
27
|
# File 'lib/rfunk/maybe/none.rb', line 25
def or(other)
RFunk.option(other)
end
|
#pipe(&_block) ⇒ Object
29
30
31
|
# File 'lib/rfunk/maybe/none.rb', line 29
def pipe(&_block)
self
end
|
#to_ary ⇒ Object
45
46
47
|
# File 'lib/rfunk/maybe/none.rb', line 45
def to_ary
[]
end
|
#to_hash ⇒ Object
49
50
51
|
# File 'lib/rfunk/maybe/none.rb', line 49
def to_hash
{}
end
|
#to_str ⇒ Object
41
42
43
|
# File 'lib/rfunk/maybe/none.rb', line 41
def to_str
''
end
|
#value ⇒ Object
21
22
23
|
# File 'lib/rfunk/maybe/none.rb', line 21
def value
RFunk::None.instance
end
|