Module: Mongoid::Extensions::String::Checks

Included in:
String
Defined in:
lib/mongoid/extensions/string/checks.rb

Overview

This module has object checks in it.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#unconvertable_to_bsonObject

:nodoc:



8
9
10
# File 'lib/mongoid/extensions/string/checks.rb', line 8

def unconvertable_to_bson
  @unconvertable_to_bson
end

Instance Method Details

#mongoid_id?true, false

Is the string a valid value for a Mongoid id?

Examples:

Is the string an id value?

"_id".mongoid_id?

Returns:

  • (true, false)

    If the string is id or _id.

Since:

  • 2.3.1



18
19
20
# File 'lib/mongoid/extensions/string/checks.rb', line 18

def mongoid_id?
  self =~ /^(|_)id$/
end

#unconvertable_to_bson?true, false

Is the object not to be converted to bson on criteria creation?

Examples:

Is the object unconvertable?

object.unconvertable_to_bson?

Returns:

  • (true, false)

    If the object is unconvertable.

Since:

  • 2.2.1



30
31
32
# File 'lib/mongoid/extensions/string/checks.rb', line 30

def unconvertable_to_bson?
  !!@unconvertable_to_bson
end