module Tod::Mongoization::ClassMethods

Public Instance Methods

demongoize(object) click to toggle source

Get the object as it was stored in the database, and instantiate this custom class from it.

# File lib/tod/mongoization.rb, line 15
def demongoize(object)
  Tod::TimeOfDay.parse(object) if object
end
evolve(object) click to toggle source

Converts the object that was supplied to a criteria and converts it into a database friendly form.

# File lib/tod/mongoization.rb, line 30
def evolve(object)
  case object
  when TimeOfDay then object.mongoize
  else object
  end
end
mongoize(object) click to toggle source

Takes any possible object and converts it to how it would be stored in the database.

# File lib/tod/mongoization.rb, line 21
def mongoize(object)
  case object
  when TimeOfDay then object.mongoize
  else object
  end
end