Skip to content

Commit

Permalink
Added some checks to see if constants defined before comparing collec…
Browse files Browse the repository at this point in the history
…tions with them
  • Loading branch information
msaspence committed Apr 23, 2014
1 parent d2a455a commit d9916ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/mongo-lock/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ def choose_driver provided_collections
collection = collections
end

if collection.is_a? Moped::Collection
if defined?(Moped::Collection) && collection.is_a?(Moped::Collection)
require 'mongo-lock/drivers/moped'
self.driver = Mongo::Lock::Drivers::Moped
elsif collection.is_a?(Mongo::Collection) or collection.nil? or collection.is_a?(String) or collection.is_a?(Symbol)
elsif (defined?(Mongo::Collection) && collection.is_a?(Mongo::Collection)) || collection.nil? || collection.is_a?(String) || collection.is_a?(Symbol)
require 'mongo-lock/drivers/mongo'
self.driver = Mongo::Lock::Drivers::Mongo
else
Expand Down

0 comments on commit d9916ee

Please sign in to comment.