Class: VagrantLXD::Action::LXD

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-lxd/action.rb

Overview

The LXD class is middleware that simply forwards its call to the corresponding method on the LXD driver and copies the result into the env hash under the key ‘:machine_<method>`.

The method to be called is controlled by the proxy object’s class name. The correct instance to use for a particular method call is retrieved with ‘LXD.action`.

Instance Method Summary collapse

Constructor Details

#initialize(app, env, *args) ⇒ LXD

Returns a new instance of LXD.



37
38
39
40
41
# File 'lib/vagrant-lxd/action.rb', line 37

def initialize(app, env, *args)
  @app = app
  @args = args
  @driver = Driver.new(env[:machine])
end

Instance Method Details

#call(env) ⇒ Object



43
44
45
46
# File 'lib/vagrant-lxd/action.rb', line 43

def call(env)
  env[:"machine_#{method}"] = @driver.send(method, *@args)
  @app.call(env)
end