Sha256: 2a9d06c7c002bd5bc9c4bfd619b5ea0b9c3f08c88636f294355cd9a75179761d
Contents?: true
Size: 587 Bytes
Versions: 5
Compression:
Stored size: 587 Bytes
Contents
module DataMapper class DependencyQueue def initialize @dependencies = Hash.new { |h,k| h[k] = [] } end def add(class_name, &b) @dependencies[class_name] << b resolve! end def resolve! @dependencies.each_pair do |class_name, callbacks| if Object.const_defined?(class_name) klass = Object.const_get(class_name) callbacks.each do |b| b.call(klass) end callbacks.clear end end end end # class DependencyQueue end # module DataMapper
Version data entries
5 entries across 5 versions & 1 rubygems