Class: VagrantPlugins::Triggers::Action::Trigger

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-triggers/action/trigger.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env, condition) ⇒ Trigger

Returns a new instance of Trigger.



7
8
9
10
11
12
13
# File 'lib/vagrant-triggers/action/trigger.rb', line 7

def initialize(app, env, condition)
  @app       = app
  @condition = condition
  @env       = env
  @exit      = false
  @logger    = Log4r::Logger.new("vagrant::plugins::triggers::trigger")
end

Instance Method Details

#call(env) ⇒ Object



15
16
17
18
19
# File 'lib/vagrant-triggers/action/trigger.rb', line 15

def call(env)
  fire_triggers unless @condition == :after
  @app.call(env) unless @exit
  fire_triggers if @condition == :after
end