Lazy object implementation
Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
README.md
Rakefile
retarded.gemspec

README.md

Simple Ruby lazy object

It has the same limitations of https://github.com/meh/refr.

Retarded { File.read('/dev/urandom', 10) }

Retarded 10 do |many|
  # `many` will be 10
  File.read('/dev/urandom', many)
end

The first time a method is called on the object it will execute the block and will be a transparent proxy (Reference like) for the resulting value.