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
# File 'lib/vagrant-proxyconf/action/base.rb', line 14

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

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

  @app.call env
end

#config_nameString

Returns the name of the configuration section.

Returns:

  • (String)

    the name of the configuration section

Raises:

  • (NotImplementedError)


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

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