Class: Monad::Maybe::Nothing
- Inherits:
-
Base
show all
- Includes:
- Singleton
- Defined in:
- lib/monad/maybe/json.rb,
lib/monad/maybe/nothing.rb
Instance Method Summary
collapse
Methods inherited from Base
#<<, #and, #maybe, #maybe?, #then, #to_list, #to_maybe
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
8
9
10
|
# File 'lib/monad/maybe/nothing.rb', line 8
def method_missing(method, *args)
self
end
|
Instance Method Details
28
29
30
|
# File 'lib/monad/maybe/nothing.rb', line 28
def bind(fn)
self
end
|
12
13
14
|
# File 'lib/monad/maybe/nothing.rb', line 12
def clone
self
end
|
16
17
18
|
# File 'lib/monad/maybe/nothing.rb', line 16
def inspect
'nothing'
end
|
#just? ⇒ Boolean
32
33
34
|
# File 'lib/monad/maybe/nothing.rb', line 32
def just?
false
end
|
#nil? ⇒ Boolean
20
21
22
|
# File 'lib/monad/maybe/nothing.rb', line 20
def nil?
true
end
|
#nothing? ⇒ Boolean
24
25
26
|
# File 'lib/monad/maybe/nothing.rb', line 24
def nothing?
true
end
|
#something? ⇒ Boolean
36
37
38
|
# File 'lib/monad/maybe/nothing.rb', line 36
def something?
false
end
|
53
54
55
|
# File 'lib/monad/maybe/nothing.rb', line 53
def to_a
[]
end
|
#to_json(*args) ⇒ Object
15
16
17
|
# File 'lib/monad/maybe/json.rb', line 15
def to_json(*args)
'null'
end
|
#to_s ⇒ Object
Also known as:
to_str
48
49
50
|
# File 'lib/monad/maybe/nothing.rb', line 48
def to_s
''
end
|
#unwrap(val) ⇒ Object
40
41
42
|
# File 'lib/monad/maybe/nothing.rb', line 40
def unwrap(val)
val
end
|
44
45
46
|
# File 'lib/monad/maybe/nothing.rb', line 44
def value
nil
end
|