Class: Quandl::Cassandra::Types::BooleanType
- Inherits:
-
AbstractType
- Object
- AbstractType
- Quandl::Cassandra::Types::BooleanType
- Defined in:
- lib/quandl/cassandra/types/boolean_type.rb
Instance Attribute Summary
Attributes inherited from AbstractType
Class Method Summary collapse
Methods inherited from AbstractType
#initialize, quote_string, #sanitize, #sanitize_for_cql, sanitize_for_cql
Constructor Details
This class inherits a constructor from Quandl::Cassandra::Types::AbstractType
Class Method Details
.sanitize(value) ⇒ Object
3 4 5 6 7 8 |
# File 'lib/quandl/cassandra/types/boolean_type.rb', line 3 def self.sanitize(value) return true if value == true || value.to_s =~ (/(true|t|yes|y|1)$/i) return false if value == false || value.blank? || value.to_s =~ (/(false|f|no|n|0)$/i) rescue raise Quandl::Cassandra::Error::CastException.new("Unable to convert value to #{name} #{value}", value) end |