Class: Dotenv::Environment
- Inherits:
-
Object
- Object
- Dotenv::Environment
- Defined in:
- lib/keyth/dotenv.rb
Overview
The two apply functions are all that need to be overwritten
Instance Method Summary collapse
-
#apply ⇒ Object
sets all environment variables that are keyth: links with the appropriate key value, sets all missing env variables otherwise.
-
#apply! ⇒ Object
sets all environment variables that are keyth: links with the appropriate key value, overwrites all env variables with the contents from .env otherwise.
Instance Method Details
#apply ⇒ Object
sets all environment variables that are keyth: links with the appropriate key value, sets all missing env variables otherwise
8 9 10 11 12 13 14 15 16 |
# File 'lib/keyth/dotenv.rb', line 8 def apply each do |k, v| if v =~ /^keyth\:(.*)/ ENV[k] = Keyth.get_key_safe(Regexp.last_match[1]) || '' else ENV[k] ||= v end end end |
#apply! ⇒ Object
sets all environment variables that are keyth: links with the appropriate key value, overwrites all env variables with the contents from .env otherwise
21 22 23 24 25 26 27 28 29 |
# File 'lib/keyth/dotenv.rb', line 21 def apply! each do |k, v| if v =~ /^keyth\:(.*)/ ENV[k] = Keyth.get_key_safe(Regexp.last_match[1]) || '' else ENV[k] = v end end end |