Skip to content

Instantly share code, notes, and snippets.

@stereosupersonic
Last active February 8, 2016 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stereosupersonic/9424292058f28ce705e5 to your computer and use it in GitHub Desktop.
Save stereosupersonic/9424292058f28ce705e5 to your computer and use it in GitHub Desktop.
config pattern
MyGem.configure do |config|
# Description of the setting here...
config.setting1 = :value
end
module MyGem
class Configuration
attr_accessor :setting1, :setting2
end
class << self
attr_reader :config
def configure
@config = Configuration.new
yield config
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment