Sha256: 0aafa31d08a221cbb89cfd15f06c232d2b9b373e7db1959a4f3d939bd0aa3003

Contents?: true

Size: 531 Bytes

Versions: 11

Compression:

Stored size: 531 Bytes

Contents

module Chillout
  class ListenerInjector
    attr_accessor :logger

    LISTENERS = [:active_record]

    def inject!
      LISTENERS.each do |listener|
        listener_injection = send("#{listener}_injector") 
        logger.info "[Chillout] Injected #{listener} listener" if listener_injection == true
      end            
    end

    def active_record_injector
      if defined?(ActiveRecord)
        ActiveRecord::Base.extend(ActiveRecordCreationListener)
        return true
      end

      return false
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
chillout-0.8.9 lib/chillout/listener_injector.rb
chillout-0.8.5.1 lib/chillout/listener_injector.rb
chillout-0.8.8 lib/chillout/listener_injector.rb
chillout-0.8.7 lib/chillout/listener_injector.rb
chillout-0.8.6 lib/chillout/listener_injector.rb
chillout-0.8.5 lib/chillout/listener_injector.rb
chillout-0.8.4 lib/chillout/listener_injector.rb
chillout-0.8.3 lib/chillout/listener_injector.rb
chillout-0.8.2 lib/chillout/listener_injector.rb
chillout-0.8.1 lib/chillout/listener_injector.rb
chillout-0.8.0 lib/chillout/listener_injector.rb