| Module | CouchRest::Model::Typecast |
| In: |
lib/couchrest/model/typecast.rb
|
Creates a DateTime instance from a Hash with keys :year, :month, :day, :hour, :min, :sec
Creates a Time instance from a Hash with keys :year, :month, :day, :hour, :min, :sec
Typecasts an arbitrary value to a DateTime. Handles both Hashes and DateTime instances. This is slow!! Use Time instead.
Convert some kind of object to a number that of the type provided.
When a string is provided, It‘ll attempt to filter out region specific details such as commas instead of points for decimal places, text units, and anything else that is not a number and a human could make out.
Esentially, the aim is to provide some kind of sanitary conversion from values in incoming http forms.
If what we get makes no sense at all, nil it.