class VWO::Services::HooksManager

Public Class Methods

new(config) click to toggle source

Hooks Manager is responsible for triggering callbacks useful to the end-user based on certain lifecycle events. Possible use with integrations when the user intends to send an event when a visitor is part of the experiment.

# File lib/vwo/services/hooks_manager.rb, line 20
def initialize(config)
  @logger = VWO::Logger.get_instance
  if config.key?(:integrations) && config[:integrations].key?(:callback) && config[:integrations][:callback].is_a?(Method)
    @callback = config[:integrations][:callback]
  end
end

Public Instance Methods

execute(properties) click to toggle source

Executes the callback @param properties Properties from the callback

# File lib/vwo/services/hooks_manager.rb, line 29
def execute(properties)
  if @callback
    @callback.call(properties)
  end
end