Module: Env
- Extended by:
- Variables
- Defined in:
- lib/env/env.rb,
lib/env/version.rb,
lib/env/variables.rb
Defined Under Namespace
Modules: Variables
Constant Summary collapse
- VERSION =
env version
"0.3.0"
Class Method Summary collapse
-
.[](name) ⇒ String?
Provides direct access to the environment variables.
-
.[]=(name, value) ⇒ String
Sets an environment variable.
-
.const_missing(name) ⇒ String?
protected
Provides transparent access to the environment variables.
-
.method_missing(name, *arguments, &block) ⇒ String?
protected
Provides transparent access to the environment variables.
Methods included from Variables
browser, columns, debug?, editor, env, home, host_name, lang, ld_library_paths, lines, parse_paths, paths, shell, shell_name, terminal, timezone, user
Class Method Details
.[](name) ⇒ String?
Provides direct access to the environment variables.
19 20 21 |
# File 'lib/env/env.rb', line 19 def Env.[](name) env[name.to_s] end |
.[]=(name, value) ⇒ String
Sets an environment variable.
35 36 37 |
# File 'lib/env/env.rb', line 35 def Env.[]=(name,value) env[name.to_s] = value.to_s end |
.const_missing(name) ⇒ String? (protected)
Provides transparent access to the environment variables.
54 55 56 |
# File 'lib/env/env.rb', line 54 def Env.const_missing(name) Env[name.to_s] end |
.method_missing(name, *arguments, &block) ⇒ String? (protected)
Provides transparent access to the environment variables.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/env/env.rb', line 75 def Env.method_missing(name,*arguments,&block) name = name.to_s if (arguments.length == 1 && name[-1..-1] == '=') name.chop! name.upcase! return Env[name] = arguments.first elsif arguments.empty? name.upcase! return Env[name] end super(name,*arguments,&block) end |