Sha256: e6c8a4a54205e5b45ce34933a0f8cffd60f1f34feacb392361abe039ca871717

Contents?: true

Size: 638 Bytes

Versions: 3

Compression:

Stored size: 638 Bytes

Contents

# encoding: UTF-8
require 'set'
require 'mongo'
require 'plucky/extensions'
require 'plucky/criteria_hash'
require 'plucky/options_hash'
require 'plucky/query'
require 'plucky/pagination'

module Plucky
  autoload :Version, 'plucky/version'

  # Array of finder DSL methods to delegate
  Methods = Plucky::Query::DSL.instance_methods.sort.map(&:to_sym)

  def self.to_object_id(value)
    return value if value.is_a?(BSON::ObjectId)
    return nil   if value.nil? || (value.respond_to?(:empty?) && value.empty?)

    if BSON::ObjectId.legal?(value.to_s)
      BSON::ObjectId.from_string(value.to_s)
    else
      value
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
plucky-0.5.2 lib/plucky.rb
plucky-0.5.1 lib/plucky.rb
plucky-0.5.0 lib/plucky.rb