Sha256: 0e4fa2e82bcb324331643e554915e02bc1d58cdbd1dd209ffcffb91b7c4bdf9f
Contents?: true
Size: 384 Bytes
Versions: 3
Compression:
Stored size: 384 Bytes
Contents
# frozen_string_literal: true class Integer def to_bool return true if self == 1 return false if zero? raise "Integer '#{self}' can't be converted to Boolean." end end class String def to_bool return true if self == "\x01" || self == "1" return false if self == "\x00" || self == "0" raise "String '#{self}' can't be converted to Boolean." end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ffi-gdal-1.1.0 | lib/ext/to_bool.rb |
ffi-gdal-1.0.4 | lib/ext/to_bool.rb |
ffi-gdal-1.0.3 | lib/ext/to_bool.rb |