Class: Kind::Maybe::None

Inherits:
Kind::Monad show all
Defined in:
lib/kind/maybe/none.rb

Constant Summary

Constants included from Kind::Monad

Kind::Monad::Error

Instance Method Summary collapse

Instance Method Details

#dig(*keys) ⇒ Object



35
36
37
# File 'lib/kind/maybe/none.rb', line 35

def dig(*keys)
  self
end

#inspectObject



43
44
45
# File 'lib/kind/maybe/none.rb', line 43

def inspect
  '#<%s value=%s>' % ['Kind::None', value.inspect]
end

#map(_method_name = UNDEFINED, &fn) ⇒ Object Also known as: map!, then, then!, check, accept, reject, and_then



14
15
16
# File 'lib/kind/maybe/none.rb', line 14

def map(_method_name = UNDEFINED, &fn)
  self
end

#none?Boolean

Returns:



12
# File 'lib/kind/maybe/none.rb', line 12

def none?; true; end

#presenceObject



39
40
41
# File 'lib/kind/maybe/none.rb', line 39

def presence
  self
end

#try!(method_name = UNDEFINED, *args, &block) ⇒ Object Also known as: try



27
28
29
30
31
# File 'lib/kind/maybe/none.rb', line 27

def try!(method_name = UNDEFINED, *args, &block)
  STRICT.kind_of(::Symbol, method_name)if UNDEFINED != method_name

  self
end

#value_or(default = UNDEFINED, &block) ⇒ Object



6
7
8
9
10
# File 'lib/kind/maybe/none.rb', line 6

def value_or(default = UNDEFINED, &block)
  Error.invalid_default_arg! if UNDEFINED == default && !block

  UNDEFINED != default ? default : block.call
end