Class: Contrast::Agent::Assess::Properties

Inherits:
Object
  • Object
show all
Includes:
Contrast::Agent::Assess::Property::Evented, Contrast::Agent::Assess::Property::Tagged, Contrast::Agent::Assess::Property::Updated
Defined in:
lib/contrast/agent/assess/properties.rb

Overview

Properties associated with a tracked String. If String is monkey patched this object is lazily generated on affected Strings.

This class acts as a holder for the Assess information we need in order to properly convey the events that lead up to the state of the tracked user input.

Instance Attribute Summary collapse

Attributes included from Contrast::Agent::Assess::Property::Evented

#event

Instance Method Summary collapse

Methods included from Contrast::Agent::Assess::Property::Updated

#copy_from, #splat_from

Methods included from Contrast::Agent::Assess::Property::Tagged

#delete_tags_at_ranges, #remove_tags, #shift_tags, #shift_tags_comparison, #shift_tags_for_deletion, #shift_tags_for_insertion, #tags_remove_comparison, #tracked?

Methods included from Utils::Assess::TaggedUtils

#add_tag, #any_tags_between?, #cleanup_tags, #clear_tags, #delete_tags, #fetch_tag, #get_tags, #set_tags, #tag_keys, #tagged?, #tags_at, #tags_at_range

Methods included from Contrast::Agent::Assess::Property::Evented

#build_event

Instance Attribute Details

#dupped_fromObject

Returns the value of attribute dupped_from.



24
25
26
# File 'lib/contrast/agent/assess/properties.rb', line 24

def dupped_from
  @dupped_from
end

Instance Method Details

#add_properties(hash) ⇒ Object



33
34
35
36
37
# File 'lib/contrast/agent/assess/properties.rb', line 33

def add_properties hash
  return unless hash

  properties.merge!(hash)
end

#add_property(name, value) ⇒ Object



39
40
41
42
43
# File 'lib/contrast/agent/assess/properties.rb', line 39

def add_property name, value
  return unless name && value

  properties[name] = value
end

#dupObject



45
46
47
48
49
# File 'lib/contrast/agent/assess/properties.rb', line 45

def dup
  ret = super
  ret.dupped_from = __id__
  ret
end

#propertiesObject

CONTRAST-36937 Creating these on Properties is expensive. We want to delay this for as long as possible.



29
30
31
# File 'lib/contrast/agent/assess/properties.rb', line 29

def properties
  @_properties ||= {}
end