It is known that in Ruby, class methods get inherited:
class P
def self.mm; puts \'abc\' end
end
class Q < P; end
Q.mm # works
However
As Sergio mentioned in comments, for guys who are already in Rails (or don’t mind depending on Active Support), Concern is helpful here:
require 'active_support/concern'
module Common
extend ActiveSupport::Concern
def instance_method
puts "instance method here"
end
class_methods do
def class_method
puts "class method here"
end
end
end
class A
include Common
end