Class: Datadog::Core::Remote::Configuration::Content

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

Overview

Content stores the information associated with a specific Configuration::Path

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:, data:) ⇒ Content

Returns a new instance of Content.



23
24
25
26
27
# File 'lib/datadog/core/remote/configuration/content.rb', line 23

def initialize(path:, data:)
  @path = path
  @data = data
  @hashes = {}
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



21
22
23
# File 'lib/datadog/core/remote/configuration/content.rb', line 21

def data
  @data
end

#hashesObject (readonly)

Returns the value of attribute hashes.



21
22
23
# File 'lib/datadog/core/remote/configuration/content.rb', line 21

def hashes
  @hashes
end

#pathObject (readonly)

Returns the value of attribute path.



21
22
23
# File 'lib/datadog/core/remote/configuration/content.rb', line 21

def path
  @path
end

Class Method Details

.parse(hash) ⇒ Object



13
14
15
16
17
18
# File 'lib/datadog/core/remote/configuration/content.rb', line 13

def parse(hash)
  path = Path.parse(hash[:path])
  data = hash[:content]

  new(path: path, data: data)
end

Instance Method Details

#hexdigest(type) ⇒ Object



29
30
31
# File 'lib/datadog/core/remote/configuration/content.rb', line 29

def hexdigest(type)
  @hashes[type] || compute_and_store_hash(type)
end

#lengthObject



33
34
35
# File 'lib/datadog/core/remote/configuration/content.rb', line 33

def length
  @length ||= @data.size
end