Sha256: 5f1859bb8399d990495953c56d28c32e05fb646dce401bc4b3a0402ebd7bb38b

Contents?: true

Size: 886 Bytes

Versions: 7

Compression:

Stored size: 886 Bytes

Contents

# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true

cs__scoped_require 'contrast/utils/object_share'

module Contrast
  module Utils
    # Utility methods for asserting truthy or falsy state of a value expected
    # to equate to a boolean
    class BooleanUtil
      class << self
        def false? config
          return false if config == true
          return true if config == false
          return false unless config.cs__is_a?(String)

          Contrast::Utils::ObjectShare::FALSE.casecmp?(config)
        end

        def true? config
          return false if config == false
          return true if config == true
          return false unless config.cs__is_a?(String)

          Contrast::Utils::ObjectShare::TRUE.casecmp?(config)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
contrast-agent-3.13.2 lib/contrast/utils/boolean_util.rb
contrast-agent-3.13.1 lib/contrast/utils/boolean_util.rb
contrast-agent-3.13.0 lib/contrast/utils/boolean_util.rb
contrast-agent-3.12.2 lib/contrast/utils/boolean_util.rb
contrast-agent-3.12.1 lib/contrast/utils/boolean_util.rb
contrast-agent-3.12.0 lib/contrast/utils/boolean_util.rb
contrast-agent-3.11.0 lib/contrast/utils/boolean_util.rb