| Module | Lazy |
| In: |
lib/grit/lazy.rb
|
Allows attributes to be declared as lazy, meaning that they won‘t be computed until they are asked for.
Works by delegating each lazy_reader to a cached lazy_source method.
class Person
lazy_reader :eyes
def lazy_source
OpenStruct.new(:eyes => 2)
end
end
>> Person.new.eyes