Sha256: 5f4382221a100012c6b3fb21eba8e9f0dc405912e25d740418cb2b0b744a6a0e
Contents?: true
Size: 1.18 KB
Versions: 10
Compression:
Stored size: 1.18 KB
Contents
module Vagrant module Action module Builtin # This class is used within the Builder class for injecting triggers into # different parts of the call stack. class Trigger # @param [Class, String, Symbol] name Name of trigger to fire # @param [Vagrant::Plugin::V2::Triger] triggers Trigger object # @param [Symbol] timing When trigger should fire (:before/:after) # @param [Symbol] type Type of trigger def initialize(app, env, name, triggers, timing, type=:action, all: false) @app = app @env = env @triggers = triggers @name = name @timing = timing @type = type @all = all if ![:before, :after].include?(timing) raise ArgumentError, "Invalid value provided for `timing` (allowed: :before or :after)" end end def call(env) machine = env[:machine] machine_name = machine.name if machine @triggers.fire(@name, @timing, machine_name, @type, all: @all) # Carry on @app.call(env) end end end end end
Version data entries
10 entries across 10 versions & 3 rubygems