Module: Kind::Maybe::Methods

Defined in:
lib/kind/maybe/methods.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



17
18
19
# File 'lib/kind/maybe/methods.rb', line 17

def self.included(base)
  base.send(:private, :Some, :None)
end

Instance Method Details

#Maybe(&block) ⇒ Object



5
6
7
# File 'lib/kind/maybe/methods.rb', line 5

def Maybe(&block)
  Kind::Maybe.from(&block)
end

#NoneObject



9
10
11
# File 'lib/kind/maybe/methods.rb', line 9

def None
  Kind::Maybe::NONE_INSTANCE
end

#Some(value = UNDEFINED, &block) ⇒ Object



13
14
15
# File 'lib/kind/maybe/methods.rb', line 13

def Some(value = UNDEFINED, &block)
  UNDEFINED == value && block ? Maybe(&block) : Kind::Maybe[value]
end