Sha256: 0deebe8052840996f2b18d693c4e5794344edab0cdafddaddabbae0e456720b8

Contents?: true

Size: 639 Bytes

Versions: 1

Compression:

Stored size: 639 Bytes

Contents

module Quebert
  module AsyncSender
    
    # I'm not sure if I want to do this or build serializers per type of object...
    module ActiveRecord
      class RecordJob < Job
        def perform(record, meth, args)
          record.send(meth, *args)
        end
      end
      
      def self.included(base)
        base.send(:include, InstanceMethods)
        base.send(:include, AsyncSender::Object)
      end
      
      module InstanceMethods
        # The meat of dealing with ActiveRecord instances.
        def async_send(meth, *args)
          RecordJob.new(self, meth, args).enqueue
        end
      end
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quebert-0.0.6 lib/quebert/async_sender/active_record.rb