Class: DeadSimpleDb::SdbBoolean
- Inherits:
-
Object
- Object
- DeadSimpleDb::SdbBoolean
- Defined in:
- lib/dead_simple_db/datatypes/sdb_boolean.rb
Instance Method Summary collapse
- #casted ⇒ Object
-
#initialize(value, opts = {}) ⇒ SdbBoolean
constructor
A new instance of SdbBoolean.
- #to_s ⇒ Object
Constructor Details
#initialize(value, opts = {}) ⇒ SdbBoolean
Returns a new instance of SdbBoolean.
5 6 7 |
# File 'lib/dead_simple_db/datatypes/sdb_boolean.rb', line 5 def initialize(value, opts={}) @value_before_cast = value end |
Instance Method Details
#casted ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/dead_simple_db/datatypes/sdb_boolean.rb', line 9 def casted @casted = if @value_before_cast || false if @value_before_cast.respond_to?(:downcase) @value_before_cast.downcase == 'false' ? false : true else true end else false end end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/dead_simple_db/datatypes/sdb_boolean.rb', line 21 def to_s casted.to_s.upcase end |