Project

General

Profile

Actions

Feature #12933

closed

Add Some and Optional

Added by saveav (Adam Pahlevi Baihaqi) over 7 years ago. Updated over 7 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:78118]

Description

What if we have Optional and None as a class, and which we can use like this:

have_data = Optional(5).get # returns 5
have_data = Some(nil) # raise error
have_data = Some(operation).expect("cannot be nil") # raise cannot be nil if operation returned nil
Actions

Also available in: Atom PDF

Like0
Like0Like0