Sha256: 99ced9e7f3650db6cd69aa7d25e6f3ef92c910cb3242cafc1527426c711876f7

Contents?: true

Size: 376 Bytes

Versions: 6

Compression:

Stored size: 376 Bytes

Contents

require 'chillout/creations_container'

module Chillout
  module CreationListener
    def inherited(subclass)
      super
      class_name = subclass.name
      subclass.after_commit on: :create do
        Thread.current[:creations] ||= CreationsContainer.new
        creations = Thread.current[:creations]
        creations.increment!(class_name)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
chillout-0.4.0 lib/chillout/creation_listener.rb
chillout-0.3.0 lib/chillout/creation_listener.rb
chillout-0.2.3 lib/chillout/creation_listener.rb
chillout-0.2.2 lib/chillout/creation_listener.rb
chillout-0.2.1 lib/chillout/creation_listener.rb
chillout-0.2.0 lib/chillout/creation_listener.rb