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, 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
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.