Class: Mongomatic::TypeConverters::ObjectId

Inherits:
Base
  • Object
show all
Defined in:
lib/mongomatic/type_converters.rb

Instance Method Summary collapse

Methods inherited from Base

#cast, #initialize

Constructor Details

This class inherits a constructor from Mongomatic::TypeConverters::Base

Instance Method Details

#convert_orig_valObject



138
139
140
141
142
# File 'lib/mongomatic/type_converters.rb', line 138

def convert_orig_val
  ::BSON::ObjectId(@orig_val.to_s)
rescue ::BSON::InvalidObjectId => e
  nil
end

#type_match?Boolean

Returns:

  • (Boolean)


134
135
136
# File 'lib/mongomatic/type_converters.rb', line 134

def type_match?
  @orig_val.kind_of? ::BSON::ObjectId
end