Sha256: 3bcd71fdc866f480db6ebd89caa955a0a9ab4e76cb8c9d25035b93f468509d18

Contents?: true

Size: 272 Bytes

Versions: 18

Compression:

Stored size: 272 Bytes

Contents

class String
    def to_boolean
        return true if self == true || self =~ (/(true|t|yes|y|1)$/i)
        return false if self == false || self.nil? || self =~ (/(false|f|no|n|0)$/i)
        raise ArgumentError.new("invalid value for Boolean: \"#{self}\"")
    end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
l5m-tools-0.2.0 lib/l5m-tools/string.rb
l5m-tools-0.1.4 lib/l5m-tools/string.rb
l5m-tools-0.1.3 lib/l5m-tools/string.rb
l5m-tools-0.1.2 lib/l5m-tools/string.rb
l5m-tools-0.1.1 lib/l5m-tools/string.rb
l5m-tools-0.1.0 lib/l5m-tools/string.rb
l5m-tools-0.0.11 lib/l5m-tools/string.rb
l5m-tools-0.0.10 lib/l5m-tools/string.rb
l5m-tools-0.0.9 lib/l5m-tools/string.rb
l5m-tools-0.0.8 lib/l5m-tools/string.rb
l5m-tools-0.0.7 lib/l5m-tools/string.rb
l5m-tools-0.0.6 lib/l5m-tools/string.rb
l5m-tools-0.0.5 lib/l5m-tools/string.rb
l5m-tools-0.0.4 lib/l5m-tools/string.rb
l5m-tools-0.0.3 lib/l5m-tools/string.rb
l5m-tools-0.0.2 lib/l5m-tools/string.rb
l5m-tools-0.0.2.beta lib/l5m-tools/string.rb
l5m-tools-0.0.2.pre lib/l5m-tools/string.rb