Sha256: 7975f8fb99ad256db926f63b3f8d3f88a169dffc734d4e25440acb25445ae04e
Contents?: true
Size: 342 Bytes
Versions: 9
Compression:
Stored size: 342 Bytes
Contents
# frozen_string_literal: true class Integer def to_bool return true if self == 1 return false if zero? 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.zero? raise "String '#{self}' can't be converted to Boolean." end end
Version data entries
9 entries across 9 versions & 1 rubygems