Class: Vagrant::LXC::Action::Message

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

Instance Method Summary collapse

Constructor Details

#initialize(app, env, msg_key, type = :info) ⇒ Message

Returns a new instance of Message.



5
6
7
8
9
# File 'lib/vagrant-lxc/action/message.rb', line 5

def initialize(app, env, msg_key, type = :info)
  @app     = app
  @msg_key = msg_key
  @type    = type
end

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/vagrant-lxc/action/message.rb', line 11

def call(env)
  machine = env[:machine]
  message = I18n.t("vagrant_lxc.messages.#{@msg_key}", name: machine.name)

  env[:ui].send @type, message

  @app.call env
end