Sha256: dfc727fb82e2c2f7800c25cedd30a55e868cd40f0b40e606c34f503577daad6c
Contents?: true
Size: 397 Bytes
Versions: 5
Compression:
Stored size: 397 Bytes
Contents
# frozen_string_literal: true 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
5 entries across 5 versions & 1 rubygems