Class: Datadog::Core::Remote::Configuration::Repository::ChangeSet

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

Overview

Store list of Changes

Instance Method Summary collapse

Instance Method Details

#add(path, previous, content) ⇒ Object



282
283
284
285
286
287
288
289
# File 'lib/datadog/core/remote/configuration/repository.rb', line 282

def add(path, previous, content)
  return if previous.nil? && content.nil?

  return deleted(path, previous) if previous && content.nil?
  return inserted(path, content) if content && previous.nil?

  updated(path, content, previous) if content && previous
end

#deleted(path, previous) ⇒ Object



291
292
293
# File 'lib/datadog/core/remote/configuration/repository.rb', line 291

def deleted(path, previous)
  self << Change::Deleted.new(path, previous).freeze
end

#inserted(path, content) ⇒ Object



295
296
297
# File 'lib/datadog/core/remote/configuration/repository.rb', line 295

def inserted(path, content)
  self << Change::Inserted.new(path, content).freeze
end

#pathsObject



278
279
280
# File 'lib/datadog/core/remote/configuration/repository.rb', line 278

def paths
  map(&:path)
end

#updated(path, content, previous) ⇒ Object



299
300
301
# File 'lib/datadog/core/remote/configuration/repository.rb', line 299

def updated(path, content, previous)
  self << Change::Updated.new(path, content, previous).freeze
end