Last active
September 9, 2019 09:50
-
-
Save ysv/1cc39a7a8f22a55821e3604296d4b861 to your computer and use it in GitHub Desktop.
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
module MyApp | |
def config | |
Config.instance | |
end | |
class Config | |
include Singleton | |
attr_reader :env | |
def initialize | |
yml = YAML.load_file("config.yml") | |
@env = ENV.fetch('MY_APP_ENV', :development) | |
@config = Hashie::Mash.new(yml[@env]) | |
end | |
def method_missing(name, *args, &block) | |
# if there is no method delegate to @config Mash. | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment