Class: Rubyfox::Server::Environment
- Inherits:
-
Object
- Object
- Rubyfox::Server::Environment
- Defined in:
- lib/rubyfox/server/environment.rb
Instance Method Summary collapse
- #[](name) ⇒ Object
- #[]=(name, value) ⇒ Object
-
#initialize(env, asker) ⇒ Environment
constructor
A new instance of Environment.
Constructor Details
#initialize(env, asker) ⇒ Environment
Returns a new instance of Environment.
4 5 6 7 8 |
# File 'lib/rubyfox/server/environment.rb', line 4 def initialize(env, asker) @env = env @asker = asker @local = {} end |
Instance Method Details
#[](name) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rubyfox/server/environment.rb', line 10 def [](name) name = name.to_s value = @local[name] || @env[name] value || begin msg = "Specify env #{name}:" loop do answer = @asker.ask(msg) unless answer.empty? self[name] = answer break answer end end end end |
#[]=(name, value) ⇒ Object
25 26 27 |
# File 'lib/rubyfox/server/environment.rb', line 25 def []=(name, value) @local[name.to_s] = value end |