Class: Manioc::Env
- Inherits:
-
Object
show all
- Defined in:
- lib/manioc/env.rb
Constant Summary
collapse
- Unset =
Class.new StandardError
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
13
14
15
16
17
18
19
20
|
# File 'lib/manioc/env.rb', line 13
def method_missing name, *args
super if args.count > 1
if name =~ /\A(.*)!\Z/
fetch $1
else
self[name.to_s]
end
end
|
Instance Method Details
#[](key) ⇒ Object
9
10
11
|
# File 'lib/manioc/env.rb', line 9
def [] key
ENV[key]
end
|
#fetch(key) ⇒ Object
5
6
7
|
# File 'lib/manioc/env.rb', line 5
def fetch key
ENV[key] || raise(Unest, key)
end
|