Sha256: 415df68c882a23676f557c3bd81ed91d06759306462ca25b48a9ac828ed037bd

Contents?: true

Size: 439 Bytes

Versions: 3

Compression:

Stored size: 439 Bytes

Contents

module DeadSimpleDb

  class SdbBoolean

    def initialize(value, opts={})
      @value_before_cast = value
    end

    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

    def to_s
      casted.to_s.upcase
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hungryblank-dead_simple_db-0.0.1 lib/dead_simple_db/datatypes/sdb_boolean.rb
hungryblank-dead_simple_db-0.0.2 lib/dead_simple_db/datatypes/sdb_boolean.rb
hungryblank-dead_simple_db-0.0.3 lib/dead_simple_db/datatypes/sdb_boolean.rb