Last active
August 29, 2015 14:06
-
-
Save wteuber/02ba17b5e32e496f533b to your computer and use it in GitHub Desktop.
configurable in ruby modules
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
module Foo | |
include ActiveSupport::Configurable | |
class << self | |
def configure | |
yield config | |
end | |
end | |
end | |
Foo.configure do |config| | |
config.bar = 'buz' | |
end | |
Foo.config.great = :stuff | |
Foo.config.bar # => "buz" | |
Foo.config.great # => :stuff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment