May 13, 2017 by Daniel P. Clark

Don’t Use Objects as Hash Keys in Ruby*

Hashes have been optimized for symbols and strings in Ruby which technically are objects but this article is for revealing how much of a difference this makes when using other objects as hash keys.  There are some cases where this makes a big difference but many times you won’t notice much of a difference. I…

Continue Reading »

May 2, 2015 by Daniel P. Clark

Private Module Methods in Ruby

So this is something I’ve looked into many times over the years and have never found an answer to.  But great news is that I’ve found a way! It’s as simple as defining module methods as private within the singleton class.  Here’s how I did it in my gem PolyBelongsTo module PolyBelongsTo::Core extend ActiveSupport::Concern included…

Continue Reading »