publisher.rb 390 Bytes
Newer Older
Marcel Hoppe's avatar
Marcel Hoppe committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
require_relative 'basics'
require_relative 'active_record/hooks'

module ActiveBunny
  class Publisher
    extend ActiveSupport::DescendantsTracker
    extend ::ActiveBunny::Basics
    extend ::ActiveBunny::ActiveRecord::Hooks

    def publish(obj, method=nil)
      method ||= caller_locations(1,1)[0].label
      ActiveBunny.publish(self.class.name, method.to_sym, obj)
    end
  end
end