3 ms·
To get lazy in Ruby, I've been using the rspec-style rlet gem: https://github.com/hosh/rlet https://github.com/hosh/rlet For example, in Rail, instead of setti
by cpursley 11y ago
To get lazy in Ruby, I've been using the rspec-style rlet gem: https://github.com/hosh/rlet https://github.com/hosh/rlet
For example, in Rail, instead of setting up a variable in a private method for a before_action, you write:
`let(:ar_model) { ArModel.ar_scoping_stuff }`
This defines a method (where the values are memoized) that can be shared across multiple objects.