Sha256: 70bc05a63f14ed055cfbb42be82751e32cf7bdc37991e2cb9e11e368ac05721c

Contents?: true

Size: 812 Bytes

Versions: 4

Compression:

Stored size: 812 Bytes

Contents

module Devise
  module Async
    class Worker
      class << self

      # Used is the internal interface for devise-async to enqueue notifications
      # to the desired backend.
      def enqueue(method, resource_class, resource_id, *args)
        # convert args to strings and hashes with string keys before passing to backend
        args = stringify_args args
        backend_class.enqueue(method, resource_class, resource_id, *args)
      end

      private

      def stringify_args(args)
        args.map do |a|
          case a
            when Hash
              a.stringify_keys
            when Symbol
              a.to_s
            else
              a
          end
        end
      end

      def backend_class
        Backend.for(Devise::Async.backend)
      end
        end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
devise-async-0.10.1 lib/devise/async/worker.rb
devise-async-0.10.1.alpha lib/devise/async/worker.rb
devise-async-0.9.0 lib/devise/async/worker.rb
devise-async-0.8.0 lib/devise/async/worker.rb