Last active
February 8, 2016 09:49
-
-
Save stereosupersonic/9424292058f28ce705e5 to your computer and use it in GitHub Desktop.
config pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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