module Methods def my_accessor(sth) define_method "current_#{sth}".intern do "Something!" end define_method("current_#{sth}=".intern) do |arg| "Set Something to #{arg}!" end end end class Foo class << self include Methods end end class Bar < Foo my_accessor "test" end p Bar.new.current_test p Bar.new.current_test= 'foo'