Sha256: d620b48ec8044bfef88372d390f02135490f59d10d76d465617d37c83dbc8e28

Contents?: true

Size: 925 Bytes

Versions: 170

Compression:

Stored size: 925 Bytes

Contents

# encoding: utf-8
module Mongoid #:nodoc:
  module Extensions #:nodoc:
    module String #:nodoc:

      # This module has object checks in it.
      module Checks #:nodoc:
        attr_accessor :unconvertable_to_bson

        # Is the string a valid value for a Mongoid id?
        #
        # @example Is the string an id value?
        #   "_id".mongoid_id?
        #
        # @return [ true, false ] If the string is id or _id.
        #
        # @since 2.3.1
        def mongoid_id?
          self =~ /^(|_)id$/
        end

        # Is the object not to be converted to bson on criteria creation?
        #
        # @example Is the object unconvertable?
        #   object.unconvertable_to_bson?
        #
        # @return [ true, false ] If the object is unconvertable.
        #
        # @since 2.2.1
        def unconvertable_to_bson?
          !!@unconvertable_to_bson
        end
      end
    end
  end
end

Version data entries

170 entries across 78 versions & 4 rubygems

Version Path
classiccms-0.6.4 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/extensions/string/checks.rb
classiccms-0.6.4 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/extensions/string/checks.rb
classiccms-0.6.4 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/extensions/string/checks.rb
classiccms-0.6.3 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/extensions/string/checks.rb
classiccms-0.6.3 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/extensions/string/checks.rb
classiccms-0.6.3 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/extensions/string/checks.rb
classiccms-0.6.2 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/extensions/string/checks.rb
classiccms-0.6.2 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/extensions/string/checks.rb
classiccms-0.6.2 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/extensions/string/checks.rb
classiccms-0.6.1 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/extensions/string/checks.rb
classiccms-0.6.1 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/extensions/string/checks.rb
classiccms-0.6.1 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/extensions/string/checks.rb
classiccms-0.6.0 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/extensions/string/checks.rb
classiccms-0.6.0 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/extensions/string/checks.rb
classiccms-0.6.0 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/extensions/string/checks.rb
classiccms-0.5.17 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/extensions/string/checks.rb
classiccms-0.5.17 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/extensions/string/checks.rb
classiccms-0.5.17 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/extensions/string/checks.rb
classiccms-0.5.16 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/extensions/string/checks.rb
classiccms-0.5.16 vendor/bundle/gems/mongoid-2.4.10/lib/mongoid/extensions/string/checks.rb