Extract Module

You have duplicated behavior in two or more classes.

You have duplicated behavior in two or more classes.

class Bid...

   before_save :capture_account_number

   def capture_account_number
     self.account_number = buyer.preferred_account_number
   end
 end 
  

image/svg+xml

class Bid...
   include AccountNumberCapture
 end

 module AccountNumberCapture

   def self.included(klass)
     klass.class_eval do
       before_save :capture_account_number
     end
   end

   def capture_account_number
     self.account_number = buyer.preferred_account_number
   end
 end 
  

inverse of Inline Module