April 21, 2016 by Daniel P. Clark

Use Ruby’s Refinements Anywhere With An Anonymous Class

For a long time I’ve been looking for a way to use Ruby’s refinements without building a class & method setup and then instantiating an instance of the class just to use it. And now I’ve finally found a solution. module Moo refine Fixnum do def to_s “moo” end end end # begin/end blocks allow…

Continue Reading »

February 24, 2015 by Daniel P. Clark

Writing methods for both class and instance levels

When perusing the Rails documentation for various methods I noticed something that seemed odd to me.  The method descriptions seemed to show an extra parameter as the first parameter that I was never using.  It’s strange when you use the methods all the time and it doesn’t seem to be implemented the way the documentation…

Continue Reading »