Class: VagrantPlugins::ProxyConf::Action::Base
- Inherits:
-
Object
- Object
- VagrantPlugins::ProxyConf::Action::Base
- Defined in:
- lib/vagrant-proxyconf/action/base.rb
Overview
Base class for proxy configuration Actions
Direct Known Subclasses
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#config_name ⇒ String
The name of the configuration section.
-
#initialize(app, env) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(app, env) ⇒ Base
Returns a new instance of Base.
12 13 14 15 |
# File 'lib/vagrant-proxyconf/action/base.rb', line 12 def initialize(app, env) @app = app @logger = Log4r::Logger.new('vagrant::proxyconf') end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
10 11 12 |
# File 'lib/vagrant-proxyconf/action/base.rb', line 10 def logger @logger end |
Instance Method Details
#call(env) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/vagrant-proxyconf/action/base.rb', line 17 def call(env) @app.call env machine = env[:machine] config = config(machine) if !config.enabled? logger.debug 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") write_config(machine, config) end end |
#config_name ⇒ String
Returns the name of the configuration section.
34 35 36 |
# File 'lib/vagrant-proxyconf/action/base.rb', line 34 def config_name raise NotImplementedError, "Must be implemented by the inheriting class" end |