Duplicted Code (DRY)

You can use mixins:

module A   def foo   # body   end

  def bar   # body   end end

class AA   include A end

class BB   include AA end

aa = AA.new bb = BB.new

aa.foo # works! bb.foo # works!

Enjoy, Jim Powers