Sha256: 03bfbc2ddad4960e52b0ae6a777e89ef3ca5194b65b62897631b89910b052f99

Contents?: true

Size: 313 Bytes

Versions: 2

Compression:

Stored size: 313 Bytes

Contents

class Fixnum
  def to_bool
    return true if self == 1
    return false if self == 0
    raise "Fixnum '#{self}' can't be converted to Boolean."
  end
end

class String
  def to_bool
    return true if to_i == 1
    return false if to_i == 0
    raise "String '#{self}' can't be converted to Boolean."
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta7 lib/ext/to_bool.rb
ffi-gdal-1.0.0.beta6 lib/ext/to_bool.rb