Sha256: cb1e1570f9cd9925e7fd029b8900ec6171874966f20c0a3cb28b9ec298e8d62e

Contents?: true

Size: 862 Bytes

Versions: 2

Compression:

Stored size: 862 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'

# Some aliases within Object have to happen especially early, because they're
# core to class definitions.  See lib/contrast.rb.
# ONLY very core aliasing should go there.  All the routine extension should
# happen here, where you'd expect it.
class Object
  # Return a String representing the self invoking this method.
  def cs__inspect
    if cs__is_a?(String)
      return Contrast::Utils::ObjectShare::EMPTY_STRING if empty?

      dup
    elsif cs__is_a?(Symbol)
      ":#{ self }"
    elsif cs__is_a?(Numeric)
      to_s
    elsif cs__is_a?(Module)
      "#{ cs__name }@#{ __id__ }"
    else
      "#{ cs__class.cs__name }@#{ __id__ }"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
contrast-agent-3.8.5 lib/contrast/core_extensions/object.rb
contrast-agent-3.8.4 lib/contrast/core_extensions/object.rb