module Bundler::Plugin::Events

def self.define(const, event)

def self.define(const, event)
  const = const.to_sym.freeze
  if const_defined?(const) && const_get(const) != event
    raise ArgumentError, "Attempting to reassign #{const} to a different value"
  end
  const_set(const, event) unless const_defined?(const)
  @events ||= {}
  @events[event] = const
end

def self.defined_event?(event)

Returns:
  • (Boolean) - A boolean indicating if the event has been defined

Parameters:
  • event (String) -- An event to check
def self.defined_event?(event)
  @events ||= {}
  @events.key?(event)
end

def self.reset

def self.reset
  @events.each_value do |const|
    remove_const(const)
  end
  @events = nil
end