Class: Flock::Sandbox::Context
- Inherits:
-
Object
- Object
- Flock::Sandbox::Context
- Defined in:
- lib/flock/sandbox.rb
Instance Attribute Summary collapse
-
#definition ⇒ Object
Returns the value of attribute definition.
-
#runner ⇒ Object
Returns the value of attribute runner.
Instance Method Summary collapse
- #consul_key(key) ⇒ Object
- #host(container) ⇒ Object
-
#initialize(runner, definition) ⇒ Context
constructor
A new instance of Context.
Constructor Details
#initialize(runner, definition) ⇒ Context
Returns a new instance of Context.
54 55 56 57 |
# File 'lib/flock/sandbox.rb', line 54 def initialize(runner, definition) self.runner = runner self.definition = definition end |
Instance Attribute Details
#definition ⇒ Object
Returns the value of attribute definition.
53 54 55 |
# File 'lib/flock/sandbox.rb', line 53 def definition @definition end |
#runner ⇒ Object
Returns the value of attribute runner.
53 54 55 |
# File 'lib/flock/sandbox.rb', line 53 def runner @runner end |
Instance Method Details
#consul_key(key) ⇒ Object
66 67 68 |
# File 'lib/flock/sandbox.rb', line 66 def consul_key(key) open(definition.config[:consul] + "/v1/kv/" + key + "?raw").read end |
#host(container) ⇒ Object
58 59 60 61 62 63 64 65 |
# File 'lib/flock/sandbox.rb', line 58 def host(container) case runner.target when "docker" container when "vagrant" definition.config[:private_network] end end |