Sha256: 2ccd9b7976d11175d264188b1d02d0866f190406f7fb8d7f9630586ee9c4c462

Contents?: true

Size: 850 Bytes

Versions: 3

Compression:

Stored size: 850 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 unless config
          return false if config == true
          return true if config == false

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

        def true? config
          return false unless config
          return false if config == false
          return true if config == true

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
contrast-agent-3.10.2 lib/contrast/utils/boolean_util.rb
contrast-agent-3.10.1 lib/contrast/utils/boolean_util.rb
contrast-agent-3.10.0 lib/contrast/utils/boolean_util.rb