Class: Mongoid::StringifiedSymbol
- Inherits:
-
Object
- Object
- Mongoid::StringifiedSymbol
- Defined in:
- lib/mongoid/stringified_symbol.rb
Overview
A class which sends values to the database as Strings but returns them to the user as Symbols.
Class Method Summary collapse
-
.demongoize(object) ⇒ Symbol
private
Convert the object from its mongo friendly ruby type to this type.
-
.evolve(object) ⇒ String
private
Turn the object from the Ruby type into the type type used in MQL queries.
-
.mongoize(object) ⇒ String
private
Turn the object from the Ruby type into the type type used for MongoDB persistence.
Class Method Details
.demongoize(object) ⇒ Symbol
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Convert the object from its mongo friendly ruby type to this type.
22 23 24 25 26 27 28 |
# File 'lib/mongoid/stringified_symbol.rb', line 22 def demongoize(object) if object.nil? object else object.to_s.to_sym end end |
.evolve(object) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Turn the object from the Ruby type into the type type used in MQL queries.
60 61 62 |
# File 'lib/mongoid/stringified_symbol.rb', line 60 def evolve(object) mongoize(object) end |
.mongoize(object) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Turn the object from the Ruby type into the type type used for MongoDB persistence.
41 42 43 44 45 46 47 |
# File 'lib/mongoid/stringified_symbol.rb', line 41 def mongoize(object) if object.nil? object else object.to_s end end |