Sha256: 8edef87876de256ddc04b615c12dad5fe40539e726b5faf301aaa186a980e46f
Contents?: true
Size: 287 Bytes
Versions: 3
Compression:
Stored size: 287 Bytes
Contents
# frozen_string_literal: true class String def to_bool return true if self == true || self =~ (/(true|t|yes|y|1)$/i) return false if self == false || self.blank? || self =~ (/(false|f|no|n|0)$/i) raise ArgumentError.new("invalid value for Boolean: \"#{self}\"") end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vimo-0.1.3 | lib/string_ext.rb |
vimo-0.1.1 | lib/string_ext.rb |
vimo-0.1.0 | lib/string_ext.rb |