Sha256: 40514c3b2a4ebc24da1fba84ffadc98af9fb820ab291cc5c331e7b9131b1d5f0
Contents?: true
Size: 367 Bytes
Versions: 12
Compression:
Stored size: 367 Bytes
Contents
module StringTools class String TRUE_VALUES = %w(1 t T true TRUE on ON).to_set def initialize(string) @string = string.to_s end # Public: cast string value to boolean # # Example: # StringTools::String.new('t').to_b # #=> true # # Return boolean def to_b TRUE_VALUES.include?(@string) end end end
Version data entries
12 entries across 12 versions & 1 rubygems