struct Spectator::Lazy(T)

Overview

Lazily stores a value.

Defined in:

spectator/lazy.cr

Constructors

Instance Method Summary

Instance methods inherited from class Object

should(matcher, message = nil) should, should_eventually(matcher, message = nil) should_eventually, should_never(matcher, message = nil) should_never, should_not(matcher, message = nil) should_not

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def get(&block : -> T) #

Retrieves the value, if it was previously fetched. On the first invocation of this method, it will yield. The block should return the value to store. Subsequent calls will return the same value and not yield.


[View source]