Skip to content

Instantly share code, notes, and snippets.

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 felixtriller/01f6abb60f6ce7270d8be938bd37f98f to your computer and use it in GitHub Desktop.
Save felixtriller/01f6abb60f6ce7270d8be938bd37f98f to your computer and use it in GitHub Desktop.
Rails Module Configuration
LibMattrTest.setup do |config|
config.super_setting1 = 'hi there'
config.super_setting2 = 23
end
module LibMattrTest
extend ActiveSupport::Autoload
mattr_accessor :super_setting1
@@super_setting1 = 'default'
mattr_accessor :super_setting2
@@super_setting2 = nil
def self.setup
yield self
end
end
@felixtriller
Copy link
Author

Use setting with LibMattrTest.super_setting1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment