View Source Saxaboom.Utils.Caster (Saxaboom v0.2.1)
Defines semantics for standard casting mechanisms to be called after a given value has been parsed from a document. The current out of the box casters include:
:noop
<-- the default:string
:float
:integer
:atom
:existing_atom
:boolean
- If the input is a string, the conversion will consider
["1", "on", "true", "yes", "y", "t"]
as truthy values and all other values as falsy - If the input is not a string, the conversion will force a boolean value by calling
!!
on the provided value
- If the input is a string, the conversion will consider
If the above casters do not cover a particular case (for example, Date parsing) then a function can be provided instead to resolve the correct value.