module Bundler::Plugin::Events

Public Class Methods

defined_event?(event) click to toggle source

Check if an event has been defined @param event [String] An event to check @return [Boolean] A boolean indicating if the event has been defined

# File lib/bundler/plugin/events.rb, line 28
def self.defined_event?(event)
  @events ||= {}
  @events.key?(event)
end

Private Class Methods

define(const, event) click to toggle source
# File lib/bundler/plugin/events.rb, line 6
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
reset() click to toggle source
# File lib/bundler/plugin/events.rb, line 17
def self.reset
  @events.each_value do |const|
    remove_const(const)
  end
  @events = nil
end