Skip to content

Instantly share code, notes, and snippets.

@danielcooper
Created August 12, 2012 14:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielcooper/3332088 to your computer and use it in GitHub Desktop.
Save danielcooper/3332088 to your computer and use it in GitHub Desktop.
Config block example
#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