Module CouchRest::Model::Typecast
In: lib/couchrest/model/typecast.rb

Methods

Public Instance methods

Protected Instance methods

Extracts the given args from the hash. If a value does not exist, it uses the value of Time.now.

Creates a Date instance from a Hash with keys :year, :month, :day

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 Date Handles both Hashes and Date instances.

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.

Typecasts an arbitrary value to a Time Handles both Hashes and Time instances.

Typecast a value to a true or false

[Validate]