Class: Spandx::Java::Metadata

Inherits:
Object
  • Object
show all
Defined in:
lib/spandx/java/metadata.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(artifact_id:, group_id:, version:, source: 'https://repo.maven.apache.org/maven2') ⇒ Metadata

Returns a new instance of Metadata.



8
9
10
11
12
13
# File 'lib/spandx/java/metadata.rb', line 8

def initialize(artifact_id:, group_id:, version:, source: 'https://repo.maven.apache.org/maven2')
  @artifact_id = artifact_id
  @group_id = group_id.tr('.', '/')
  @version = version
  @source = source
end

Instance Attribute Details

#artifact_idObject (readonly)

Returns the value of attribute artifact_id.



6
7
8
# File 'lib/spandx/java/metadata.rb', line 6

def artifact_id
  @artifact_id
end

#group_idObject (readonly)

Returns the value of attribute group_id.



6
7
8
# File 'lib/spandx/java/metadata.rb', line 6

def group_id
  @group_id
end

#sourceObject (readonly)

Returns the value of attribute source.



6
7
8
# File 'lib/spandx/java/metadata.rb', line 6

def source
  @source
end

#versionObject (readonly)

Returns the value of attribute version.



6
7
8
# File 'lib/spandx/java/metadata.rb', line 6

def version
  @version
end

Instance Method Details

#licensesObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/spandx/java/metadata.rb', line 15

def licenses
  return [] unless pom

  pom.search('//licenses/license').map do |node|
    {
      name: node.at_xpath('./name').text,
      url: node.at_xpath('./url').text
    }
  end
end