Sha256: d3f7e92185e9ee3dc619998614cbbd12fd288edff83f5093eca83de348588428

Contents?: true

Size: 721 Bytes

Versions: 4

Compression:

Stored size: 721 Bytes

Contents

# encoding: UTF-8
require 'set'
require 'mongo'
require 'plucky/extensions'

module Plucky
  autoload :CriteriaHash, 'plucky/criteria_hash'
  autoload :OptionsHash,  'plucky/options_hash'
  autoload :Query,        'plucky/query'
  autoload :Version,      'plucky/version'

  module Pagination
    autoload :Decorator,  'plucky/pagination/decorator'
    autoload :Paginator,  'plucky/pagination/paginator'
  end

  def self.to_object_id(value)
    if value.nil? || (value.respond_to?(:empty?) && value.empty?)
      nil
    elsif value.is_a?(BSON::ObjectId)
      value
    else
      if BSON::ObjectId.legal?(value.to_s)
        BSON::ObjectId.from_string(value.to_s)
      else
        value
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
jonbell-plucky-0.3.8 lib/plucky.rb
plucky-0.4.0 lib/plucky.rb
plucky-0.3.8 lib/plucky.rb
plucky-0.3.7 lib/plucky.rb