prevent @@subclasses from being emptied

This can happen due to Chef's stupid approach to loading library files,
which uses Kernel#load rather than #require.  Consequently a library
can get loaded twice: once by Chef::RunContext#load_libraries and once
by another library file which depends on it.

This is also the cause of the TYPE constants being redefined.
This commit is contained in:
Adam Spiers
2014-02-06 21:50:29 +00:00
parent f127600a60
commit 469950c29b

View File

@@ -4,7 +4,7 @@ module Pacemaker
class CIBObject
attr_accessor :name, :definition
@@subclasses = { }
@@subclasses = { } unless class_variable_defined?(:@@subclasses)
class << self
attr_reader :object_type