Sha256: 4ffa4503bea4acc24e8a6186360bc27eaf7b6dabdb0828d1d0868bf2912f990b

Contents?: true

Size: 725 Bytes

Versions: 2

Compression:

Stored size: 725 Bytes

Contents

require "mongoscript/orm/mongoid_adapter"
require "mongoscript/version"
require "mongoscript/execution"
require 'mongoscript/multiquery'

module MongoScript
  class NoORMError < StandardError; end

  # Returns the MongoScript adapter module for
  # whichever Mongo ORM is loaded (Mongoid, MongoMapper).
  #
  # @note: currently only Mongoid is supported.
  #
  # @raises NoORMError if no ORM module can be detected.
  #
  # @returns MongoScript::ORM::Mongoid if Mongoid is detected
  def self.orm_adapter
    if Object.const_defined? "Mongoid"
      MongoScript::ORM::MongoidAdapter
    else
      raise NoORMError, "Unable to locate Mongoid!"
    end
  end

  include orm_adapter
  include Execution
  include Multiquery
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mongoscript-0.0.10 lib/mongoscript.rb
mongoscript-0.0.9 lib/mongoscript.rb