Sha256: 75c3a3c20dd59faaadc8d2728c2e9c655021d2c21ce05259fbc3a4bf7252bc82

Contents?: true

Size: 495 Bytes

Versions: 1

Compression:

Stored size: 495 Bytes

Contents

module ModelLog
  module Log
    module Initializer
      # {
      #   resource:     object_active_record,
      #   action:       create|update|destroy,
      # }
      def initialize(resource, action)
        @resource = resource
        @action = action
        verify_action!
      end

      private

      def verify_action!
        unless %i(create destroy update).include? @action
          raise StandardError, "invalid action given #{@action}"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
model_log-2.0.0 lib/model_log/log/initializer.rb