Class: OrElse::NothingClass

Inherits:
Maybe show all
Includes:
Singleton
Defined in:
lib/or_else/nothing_class.rb

Instance Method Summary collapse

Methods inherited from Maybe

sequence

Instance Method Details

#all?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/or_else/nothing_class.rb', line 42

def all?
  true
end

#any?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/or_else/nothing_class.rb', line 46

def any?
  all?
end

#eachObject



39
40
# File 'lib/or_else/nothing_class.rb', line 39

def each
end

#empty?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/or_else/nothing_class.rb', line 19

def empty?
  true
end

#exists?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/or_else/nothing_class.rb', line 27

def exists?
  !empty?
end

#filterObject



15
16
17
# File 'lib/or_else/nothing_class.rb', line 15

def filter
  Nothing
end

#flat_mapObject



11
12
13
# File 'lib/or_else/nothing_class.rb', line 11

def flat_map
  Nothing
end

#mapObject



7
8
9
# File 'lib/or_else/nothing_class.rb', line 7

def map
  Nothing
end

#nil?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/or_else/nothing_class.rb', line 23

def nil?
  empty?
end

#or_elseObject



35
36
37
# File 'lib/or_else/nothing_class.rb', line 35

def or_else
  yield
end

#present?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/or_else/nothing_class.rb', line 31

def present?
  exists?
end