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.
15 16 17 |
# File 'lib/tod/mongoization.rb', line 15 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.
30 31 32 33 34 35 |
# File 'lib/tod/mongoization.rb', line 30 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.
21 22 23 24 25 26 |
# File 'lib/tod/mongoization.rb', line 21 def mongoize(object) case object when TimeOfDay then object.mongoize else object end end |