abstract class Crommand::Optional(T)

Overview

An abstract base class for the optional types. An optional represents a value that may or may not have been set.

Direct Known Subclasses

Defined in:

optional.cr

Instance Method Summary

Instance Method Detail

def if_set(&) : Optional #

Calling this method and passing it a block will result in the mthod yielding the optional value if and only it it has been set. This method returns self to allow for chaining.


[View source]
def if_unset(&) : Optional #

Calling this method and passing it a block will result in the mthod yielding to the block if and only it it has not been set. This method returns self to allow for chaining.


[View source]
def set? : Bool #

Used to test whether the optional has a value available or not. THis default implementation returns false.


[View source]
abstract def value : T #

An abstract method that derived classes must provide an implementation for.


[View source]