Last active
August 5, 2016 12:48
-
-
Save pavlo-vavruk/da367ae34230ee58e7d2fed46be46114 to your computer and use it in GitHub Desktop.
ENV settings proxy.
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
class Settings | |
@@envs = [] | |
def self.method_missing(name, *args) | |
@@envs << name.upcase.to_s | |
return ENV["#{@@envs.join('_')}"] || args.first unless args.empty? | |
self | |
end | |
end | |
Settings.s3.rows('tmp').inspect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
ruby settings_env_proxy.rb
=> "tmp"
S3_ROWS='env_value' ruby settings_env_proxy.rb
=> "env_value"