Sha256: 74135b527165ab188f86a0f3ad2289f932ce10016aa91dc78dc30ceaa21499cb

Contents?: true

Size: 685 Bytes

Versions: 1

Compression:

Stored size: 685 Bytes

Contents

module ActionAuditor
  module Auditor
    # The simplest possible implementation of an auditor.
    # Simply maintains a list of [message, hash] pairs,
    # with no persistence.
    # This is mainly of use for testing.
    class Simple < Base
      class LoggedAction < Struct.new(:message, :parameters)
        
      end
      
      def initialize
        @messages = []
      end
      
      def clear!
        @messages = []
      end
      
      def log(message, parameters = {})
        @messages << LoggedAction.new(message, parameters)
      end
      
      def size
        @messages.size
      end
      
      def last
        @messages.last
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
action_auditor-0.1.0 lib/action_auditor/auditor/simple.rb