Thursday, 24 July 2014

config

require 'active_support/configurable'
module GemModule
include ActiveSupport::Configurable
class << self
def setup
yield config
end
end
end
And then you can write
GemModule.setup do |config|
config.option1 = "value1"
config.option2 = 2
end
And
GemModule.config.option1
view raw gistfile1.rb hosted with ❤ by GitHub

No comments:

Post a Comment