Sha256: 1708db3de78e199b635962509f7e96841221177872818293ee836df344fb1f1d

Contents?: true

Size: 479 Bytes

Versions: 4

Compression:

Stored size: 479 Bytes

Contents

module SyncMachine
  # Adapt generic SyncMachine functionality to a specific ORM.
  module OrmAdapters
    def self.orm_adapter(sync_module)
      subject_class = sync_module.subject_class
      if const_defined?(:ActiveRecordAdapter) &&
         subject_class < ActiveRecord::Base
        ActiveRecordAdapter
      elsif const_defined?(:MongoidAdapter) &&
            subject_class.included_modules.include?(Mongoid::Document)
        MongoidAdapter
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sync_machine-1.4.0 lib/sync_machine/orm_adapters.rb
sync_machine-1.3.0 lib/sync_machine/orm_adapters.rb
sync_machine-1.2.0 lib/sync_machine/orm_adapters.rb
sync_machine-1.1.1 lib/sync_machine/orm_adapters.rb