Class: Datadog::Core::Remote::Configuration::Repository::Operation::Update

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

Overview

Update existimng repository’s contents

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, target, content) ⇒ Update

Returns a new instance of Update.



192
193
194
195
196
197
# File 'lib/datadog/core/remote/configuration/repository.rb', line 192

def initialize(path, target, content)
  super()
  @path = path
  @target = target
  @content = content
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



190
191
192
# File 'lib/datadog/core/remote/configuration/repository.rb', line 190

def content
  @content
end

#pathObject (readonly)

Returns the value of attribute path.



190
191
192
# File 'lib/datadog/core/remote/configuration/repository.rb', line 190

def path
  @path
end

#targetObject (readonly)

Returns the value of attribute target.



190
191
192
# File 'lib/datadog/core/remote/configuration/repository.rb', line 190

def target
  @target
end

Instance Method Details

#apply(repository) ⇒ Object



199
200
201
202
203
204
205
206
# File 'lib/datadog/core/remote/configuration/repository.rb', line 199

def apply(repository)
  return if repository[@path].nil?

  @content.version = @target.version
  repository.contents[@path] = @content

  @path
end