Sha256: 1da0ae0984ea94cb7c7ae1ec7840bbb34d9f688e20beb702fbbab2ae4cc91ec1

Contents?: true

Size: 860 Bytes

Versions: 1

Compression:

Stored size: 860 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

1 entries across 1 versions & 1 rubygems

Version Path
devise-async-0.10.2 lib/devise/async/worker.rb