Sha256: 164aa32ea92d483ac4094006619ed75f9726c9059124ae1b4eb0464488d615be

Contents?: true

Size: 323 Bytes

Versions: 2

Compression:

Stored size: 323 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 self.to_i == 1
    return false if self.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.beta3 lib/ext/to_bool.rb
ffi-gdal-1.0.0.beta1 lib/ext/to_bool.rb