# Pastebin hbBGYGfV class X module Methods def hi "Hi #{options.fetch(:name)}" end def bye "Bye #{options.fetch(:name)}" end end class << self include Methods attr_reader :options def config(options) @options = options end end include Methods attr_reader :options def initialize(options = {}) @options = self.class.options.merge(options) end end X.config name: 'foo' p X.hi #=> "Hi foo" p X.new(name: 'bar').hi #=> "Hi bar" p X.bye #=> "Bye foo"