Class: Contrast::Extension::Assess::HashPropagator

Inherits:
Object
  • Object
show all
Includes:
Components::Interface
Defined in:
lib/contrast/extension/assess/hash.rb,
ext/cs__assess_hash/cs__assess_hash.c

Overview

This Class provides us with a way to invoke Hash propagation for those methods which are too complex to fit into one of the standard Contrast::Agent::Assess::Policy::Propagator molds.

Class Method Summary collapse

Methods included from Components::Interface

included

Class Method Details

.cs__duplicate_and_freeze(object) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/contrast/extension/assess/hash.rb', line 16

def cs__duplicate_and_freeze object
  return object unless object.is_a?(String) && !object.cs__frozen?
  return object unless Contrast::Agent::Assess::Tracker.tracked?(object)

  ret = Contrast::Agent::Assess::Tracker.duplicate(object)
  ret.cs__freeze
rescue StandardError
  # we'll rescue this error, but we can't log it here as that will
  # result in a seg fault
end

.instrument_hash_trackObject



27
28
29
30
31
32
33
34
35
# File 'lib/contrast/extension/assess/hash.rb', line 27

def instrument_hash_track
  @_instrument_hash_track ||= begin
    require 'cs__assess_hash/cs__assess_hash'
    true
  end
rescue StandardError, LoadError => e
  logger.error('Error loading hash track patch', e)
  false
end