Class: VagrantPlugins::ProxyConf::Action::Base

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

Overview

Base class for proxy configuration Actions

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ Base

Returns a new instance of Base.



10
11
12
# File 'lib/vagrant-proxyconf/action/base.rb', line 10

def initialize(app, env)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/vagrant-proxyconf/action/base.rb', line 14

def call(env)
  machine = env[:machine]
  config  = config(machine)

  if !config.enabled?
    logger.info I18n.t("vagrant_proxyconf.#{config_name}.not_enabled")
  elsif !supported?(machine)
    env[:ui].info I18n.t("vagrant_proxyconf.#{config_name}.not_supported")
  else
    env[:ui].info I18n.t("vagrant_proxyconf.#{config_name}.configuring")
    configure_machine(machine, config)
  end

  @app.call env
end

#config_nameString

Returns the name of the configuration section.

Returns:

  • (String)

    the name of the configuration section

Raises:

  • (NotImplementedError)


31
32
33
# File 'lib/vagrant-proxyconf/action/base.rb', line 31

def config_name
  raise NotImplementedError, "Must be implemented by the inheriting class"
end