struct Spectator::Lazy(T)
 
  - Spectator::Lazy(T)
 - Struct
 - Value
 - Object
 
Overview
Lazily stores a value.
Defined in:
spectator/lazy.crConstructors
Instance Method Summary
- 
        #get(&block :  -> T)
        
          
Retrieves the value, if it was previously fetched.
 - #initialize
 
Instance methods inherited from class Object
  
  
    
      should(matcher : Spectator::Matchers::TypeMatcher(U), message = nil, *, _file = __FILE__, _line = __LINE__) forall Ushould(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should, should_eventually(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should_eventually, should_never(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should_never, should_not(matcher : Spectator::Matchers::TypeMatcher(U), message = nil, *, _file = __FILE__, _line = __LINE__) forall U
should_not(matcher : Spectator::Matchers::NilMatcher, message = nil, *, _file = __FILE__, _line = __LINE__)
should_not(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should_not
Constructor Detail
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.