Class: Literal::NothingClass

Inherits:
Maybe show all
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

Methods inherited from Maybe

#call

Methods inherited from Monad

#handle

Constructor Details

#initializeNothingClass

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

#bindLiteral::Nothing

Returns:



36
# File 'lib/literal/nothing_class.rb', line 36

def bind = self

#deconstructObject



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

Returns:

  • (true)


13
# File 'lib/literal/nothing_class.rb', line 13

def empty? = true

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/literal/nothing_class.rb', line 50

def eql?(other)
	Literal::Nothing == other
end

#filterLiteral::Nothing

Returns:



24
# File 'lib/literal/nothing_class.rb', line 24

def filter = self

#fmapLiteral::Nothing

Returns:



33
# File 'lib/literal/nothing_class.rb', line 33

def fmap = self

#inspectString

Returns:

  • (String)


10
# File 'lib/literal/nothing_class.rb', line 10

def inspect = "Literal::Nothing"

#map(type = nil) ⇒ Literal::Nothing

Returns:



27
# File 'lib/literal/nothing_class.rb', line 27

def map(type = nil) = self

#nothing?true

Returns:

  • (true)


16
# File 'lib/literal/nothing_class.rb', line 16

def nothing? = true

#something?false

Returns:

  • (false)


19
# File 'lib/literal/nothing_class.rb', line 19

def something? = false

#then(type = nil) ⇒ Literal::Nothing

Returns:



30
# File 'lib/literal/nothing_class.rb', line 30

def then(type = nil) = self

#value_orObject



21
# File 'lib/literal/nothing_class.rb', line 21

def value_or = yield