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



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

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



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

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

#inserted(path, content) ⇒ Object



282
283
284
# File 'lib/datadog/core/remote/configuration/repository.rb', line 282

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

#pathsObject



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

def paths
  map(&:path)
end

#updated(path, content, previous) ⇒ Object



286
287
288
# File 'lib/datadog/core/remote/configuration/repository.rb', line 286

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