Class: Compel::Coercion::Boolean
- Defined in:
- lib/compel/coercion/types/boolean.rb
Instance Attribute Summary
Attributes inherited from Type
Instance Method Summary collapse
Methods inherited from Type
coerce, #coerce, human_name, #initialize
Constructor Details
This class inherits a constructor from Compel::Coercion::Type
Instance Method Details
#coerce_value ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/compel/coercion/types/boolean.rb', line 6 def coerce_value if /(false|f|no|n|0)$/i === "#{value}" return false end if /(true|t|yes|y|1)$/i === "#{value}" return true end end |