123456789_123456789_123456789_123456789_123456789_

Module: Bundler::Plugin::Events

Relationships & Source Files
Defined in: lib/bundler/plugin/events.rb

Constant Summary

Class Method Summary

Class Method Details

.define(const, event) (private)

[ GitHub ]

  
# 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

.defined_event?(event) ⇒ Boolean

Check if an event has been defined

Parameters:

  • event (String)

    An event to check

Returns:

  • (Boolean)

    A boolean indicating if the event has been defined

[ GitHub ]

  
# File 'lib/bundler/plugin/events.rb', line 28

def self.defined_event?(event)
  @events ||= {}
  @events.key?(event)
end

.reset (private)

[ GitHub ]

  
# File 'lib/bundler/plugin/events.rb', line 17

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