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

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

Overview

Insert content into the repository contents

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, target, content) ⇒ Insert

Returns a new instance of Insert.



171
172
173
174
175
176
# File 'lib/datadog/core/remote/configuration/repository.rb', line 171

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

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



169
170
171
# File 'lib/datadog/core/remote/configuration/repository.rb', line 169

def content
  @content
end

#pathObject (readonly)

Returns the value of attribute path.



169
170
171
# File 'lib/datadog/core/remote/configuration/repository.rb', line 169

def path
  @path
end

#targetObject (readonly)

Returns the value of attribute target.



169
170
171
# File 'lib/datadog/core/remote/configuration/repository.rb', line 169

def target
  @target
end

Instance Method Details

#apply(repository) ⇒ Object



178
179
180
181
182
183
184
185
# File 'lib/datadog/core/remote/configuration/repository.rb', line 178

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

  @content.version = @target.version
  repository.contents << @content

  @path
end