Module: Kind::Maybe::Buildable
- Included in:
- Object
- Defined in:
- lib/kind/maybe.rb
Instance Method Summary collapse
- #maybe(value = UNDEFINED, &block) ⇒ Object (also: #optional)
Instance Method Details
#maybe(value = UNDEFINED, &block) ⇒ Object Also known as: optional
24 25 26 27 28 29 30 |
# File 'lib/kind/maybe.rb', line 24 def maybe(value = UNDEFINED, &block) return __maybe[value] if UNDEFINED != value && !block return __maybe.wrap(&block) if UNDEFINED == value && block return __maybe.wrap(value, &block) if UNDEFINED != value && block __maybe end |