hospital-systems/fhir — pull request #1 by dennispatterson (2014-04-18 21:13:39+00:00)
Title: Support multi-type arrays containing Booleans in Coercer

A multi-type array with a *Boolean* allowed type (e.g. 'attribute :multiple_birth, \*Fhir::Type[Boolean, Integer]' in *Patient*) is really supporting instances of *Virtus::Attribute::Boolean*. The existing coercer allows an attribute to be of this type, but doesn't accept a value of *true* or *false* since those are instances of *TrueClass* and *FalseClass*, respectively.

Proposed updates:
* *coerce_according_to_types* / *check_type!* - when the allowed type is *Virtus::Attribute::Boolean*, allow for *TrueClass* and *FalseClass*.
* *call* - check the type of the coerced value so that a string like "true" can still be coerced into a boolean.
* *virtus_coerce*
* Demodulize the type's name so that it looks for a "to_boolean" method on the coercer.
* Rescue from an *UnsupportedCoercion* because coercers can't always coerce to a type just because they have a method to do so. Example: An integer coercer has a to_boolean method but can't coerce an integer such as 2.
* True and false don't need to be coerced into booleans, so just return those values.