Class: Datadog::Profiling::Collectors::CodeProvenance::Library

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/profiling/collectors/code_provenance.rb

Overview

Represents metadata we have for a ruby gem

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kind:, name:, version:, path:) ⇒ Library

Returns a new instance of Library.



104
105
106
107
108
109
110
# File 'lib/datadog/profiling/collectors/code_provenance.rb', line 104

def initialize(kind:, name:, version:, path:)
  @kind = kind.freeze
  @name = name.dup.freeze
  @version = version.to_s.dup.freeze
  @path = path.dup.freeze
  freeze
end

Instance Attribute Details

#kindObject (readonly)

Returns the value of attribute kind.



102
103
104
# File 'lib/datadog/profiling/collectors/code_provenance.rb', line 102

def kind
  @kind
end

#nameObject (readonly)

Returns the value of attribute name.



102
103
104
# File 'lib/datadog/profiling/collectors/code_provenance.rb', line 102

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



102
103
104
# File 'lib/datadog/profiling/collectors/code_provenance.rb', line 102

def path
  @path
end

#versionObject (readonly)

Returns the value of attribute version.



102
103
104
# File 'lib/datadog/profiling/collectors/code_provenance.rb', line 102

def version
  @version
end

Instance Method Details

#to_json(arg = nil) ⇒ Object



112
113
114
# File 'lib/datadog/profiling/collectors/code_provenance.rb', line 112

def to_json(arg = nil)
  { kind: @kind, name: @name, version: @version, paths: [@path] }.to_json(arg)
end