Class: Unsound::Data::Nothing

Inherits:
Maybe
  • Object
show all
Defined in:
lib/unsound/data/maybe.rb

Instance Method Summary collapse

Methods inherited from Maybe

of

Instance Method Details

#>>Data::Nothing Also known as: and_then

A Noop

Returns:



44
45
46
# File 'lib/unsound/data/maybe.rb', line 44

def >>(*)
  self
end

#fmapData::Nothing

A Noop

Returns:



37
38
39
# File 'lib/unsound/data/maybe.rb', line 37

def fmap(*)
  self
end

#or_else(f = nil, &blk) ⇒ Data::Nothing, Data::Just

Chain another operation which can result in a Maybe

Parameters:

  • f (#call) (defaults to: nil)

    the next operation

Returns:



53
54
55
# File 'lib/unsound/data/maybe.rb', line 53

def or_else(f = nil, &blk)
  (f || blk).call
end