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



254
255
256
257
258
259
260
# File 'lib/datadog/core/remote/configuration/repository.rb', line 254

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?
  return updated(path, content, previous) if content && previous
end

#deleted(path, previous) ⇒ Object



262
263
264
# File 'lib/datadog/core/remote/configuration/repository.rb', line 262

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

#inserted(path, content) ⇒ Object



266
267
268
# File 'lib/datadog/core/remote/configuration/repository.rb', line 266

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

#pathsObject



250
251
252
# File 'lib/datadog/core/remote/configuration/repository.rb', line 250

def paths
  map(&:path)
end

#updated(path, content, previous) ⇒ Object



270
271
272
# File 'lib/datadog/core/remote/configuration/repository.rb', line 270

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