Sha256: 6d119d8f6920edf75414a7b33bbaf7110775adfee354e4a13d418fbcb742034e
Contents?: true
Size: 405 Bytes
Versions: 2
Compression:
Stored size: 405 Bytes
Contents
class Object def to_b case self when true, false then self when nil then false else to_i != 0 end end end class String TRUE_REGEXP = /^(yes|true|on|t|1|\-1)$/i.freeze FALSE_REGEXP = /^(no|false|off|f|0)$/i.freeze def to_b case self when TRUE_REGEXP then true when FALSE_REGEXP then false else to_i != 0 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
datashift-0.2.1 | lib/helpers/core_ext/to_b.rb |
datashift-0.0.1 | lib/helpers/core_ext/to_b.rb |