Sha256: 974aca6417b5c0e43338c990e77eccfa2f610a8951210b077140a3be729b4e72

Contents?: true

Size: 510 Bytes

Versions: 4

Compression:

Stored size: 510 Bytes

Contents

require 'wisper'

module ProxES
  class Listener
    def initialize
      @mutex = Mutex.new
    end

    def method_missing(method, *args)
      vals = { action: method }
      vals[:user] = args[0][:user] if args[0] && args[0].key?(:user)
      vals[:details] = args[0][:details] if args[0] && args[0].key?(:details)
      @mutex.synchronize { AuditLog.create vals }
    end

    def respond_to_missing?(_method, _include_private = false)
      true
    end
  end
end

Wisper.subscribe(ProxES::Listener.new)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
proxes-0.4.4 lib/proxes/listener.rb
proxes-0.4.3 lib/proxes/listener.rb
proxes-0.4.2 lib/proxes/listener.rb
proxes-0.4.1 lib/proxes/listener.rb