Sha256: a396d98b8dd0d3a4920be7f6f52c8b8057dce4091fbe1850a269a4a73dcdd8db

Contents?: true

Size: 875 Bytes

Versions: 3

Compression:

Stored size: 875 Bytes

Contents

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

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

3 entries across 3 versions & 1 rubygems

Version Path
contrast-agent-3.16.0 lib/contrast/utils/boolean_util.rb
contrast-agent-3.15.0 lib/contrast/utils/boolean_util.rb
contrast-agent-3.14.0 lib/contrast/utils/boolean_util.rb