Module: Tod::Mongoization::ClassMethods
- Included in:
- TimeOfDay
- Defined in:
- lib/tod/mongoization.rb
Instance Method Summary collapse
-
#demongoize(object) ⇒ Object
Get the object as it was stored in the database, and instantiate this custom class from it.
-
#evolve(object) ⇒ Object
Converts the object that was supplied to a criteria and converts it into a database friendly form.
-
#mongoize(object) ⇒ Object
Takes any possible object and converts it to how it would be stored in the database.
Instance Method Details
#demongoize(object) ⇒ Object
Get the object as it was stored in the database, and instantiate this custom class from it.
13 14 15 |
# File 'lib/tod/mongoization.rb', line 13 def demongoize(object) Tod::TimeOfDay.parse(object) if object end |
#evolve(object) ⇒ Object
Converts the object that was supplied to a criteria and converts it into a database friendly form.
28 29 30 31 32 33 |
# File 'lib/tod/mongoization.rb', line 28 def evolve(object) case object when TimeOfDay then object.mongoize else object end end |
#mongoize(object) ⇒ Object
Takes any possible object and converts it to how it would be stored in the database.
19 20 21 22 23 24 |
# File 'lib/tod/mongoization.rb', line 19 def mongoize(object) case object when TimeOfDay then object.mongoize else object end end |