Class: Vagrant::Action::VM::HostName
- Inherits:
-
Object
- Object
- Vagrant::Action::VM::HostName
- Defined in:
- lib/vagrant/action/vm/host_name.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ HostName
constructor
A new instance of HostName.
Constructor Details
#initialize(app, env) ⇒ HostName
Returns a new instance of HostName.
5 6 7 |
# File 'lib/vagrant/action/vm/host_name.rb', line 5 def initialize(app, env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/vagrant/action/vm/host_name.rb', line 9 def call(env) @app.call(env) host_name = env[:vm].config.vm.host_name if !host_name.nil? env[:ui].info I18n.t("vagrant.actions.vm.host_name.setting") env[:vm].guest.change_host_name(host_name) end end |