Class: CassandraModel::BooleanType
- Defined in:
- lib/cassandra-model/types.rb
Class Method Summary collapse
Class Method Details
.dump(v) ⇒ Object
90 91 92 |
# File 'lib/cassandra-model/types.rb', line 90 def self.dump(v) object_to_boolean(v) ? '1' : '0' end |
.load(v) ⇒ Object
94 95 96 |
# File 'lib/cassandra-model/types.rb', line 94 def self.load(v) v == '1' end |
.object_to_boolean(value) ⇒ Object
98 99 100 |
# File 'lib/cassandra-model/types.rb', line 98 def self.object_to_boolean value return [true, "true", 1, "1", "T", "t", "Y", "y", "yes"].include?(value.class == String ? value.downcase : value) end |