Class: Datadog::Core::Remote::Configuration::Target

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/core/remote/configuration/target.rb

Overview

Target stores digest information

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(digests:, length:, version:) ⇒ Target

Returns a new instance of Target.



59
60
61
62
63
# File 'lib/datadog/core/remote/configuration/target.rb', line 59

def initialize(digests:, length:, version:)
  @digests = digests
  @length = length
  @version = version
end

Instance Attribute Details

#digestsObject (readonly)

Returns the value of attribute digests.



57
58
59
# File 'lib/datadog/core/remote/configuration/target.rb', line 57

def digests
  @digests
end

#lengthObject (readonly)

Returns the value of attribute length.



57
58
59
# File 'lib/datadog/core/remote/configuration/target.rb', line 57

def length
  @length
end

#versionObject (readonly)

Returns the value of attribute version.



57
58
59
# File 'lib/datadog/core/remote/configuration/target.rb', line 57

def version
  @version
end

Class Method Details

.parse(hash) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/datadog/core/remote/configuration/target.rb', line 48

def parse(hash)
  length = Integer(hash['length'])
  digests = Configuration::DigestList.parse(hash['hashes'])
  version = Integer(hash['custom']['v'])

  new(digests: digests, length: length, version: version)
end

Instance Method Details

#check(content) ⇒ Object



67
68
69
# File 'lib/datadog/core/remote/configuration/target.rb', line 67

def check(content)
  digests.check(content)
end