Created
August 12, 2012 14:33
-
-
Save danielcooper/3332088 to your computer and use it in GitHub Desktop.
Config block example
This file contains hidden or 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
#Usage: | |
# Awesome.configure do |a| | |
# a.magic_number = 3 | |
# end | |
module Awesome | |
class << self | |
attr_accessor :configuration | |
def config | |
self.configuration ||= Configuration.new | |
end | |
def configure | |
yield(config) | |
end | |
end | |
# The configuration object. | |
class Configuration < Hashie::Mash | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment