travisjeffery / timecop

A gem providing "time travel", "time freezing", and "time acceleration" capabilities, making it simple to test time-dependent code. It provides a unified method to mock Time.now, Date.today, and DateTime.now in a single call.
MIT License
3.37k stars 226 forks source link

Avoid Kernel#send() #368

Closed jhawthorn closed 2 years ago

jhawthorn commented 3 years ago

Previously all timecop instance methods were private and we would call them from the class methods using send(). This commit achieves a similar effect (making the instance methods inaccessible to users) by making instance private.

Using standard method calls instead of send should be slightly faster as it reduces method lookups.

joshuacronemeyer commented 2 years ago

This is nice.