Class: CircleCI::CoverageReporter::Artifact

Inherits:
Struct
  • Object
show all
Defined in:
lib/circleci/coverage_reporter/artifact.rb

Overview

Encapsulate a CircleCI artifact

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#node_indexInteger

the ID of the artifact's container

Returns:

  • (Integer)

    the current value of node_index



8
9
10
# File 'lib/circleci/coverage_reporter/artifact.rb', line 8

def node_index
  @node_index
end

#pathString

abstract path to the artifact in CircleCI container

Returns:

  • (String)

    the current value of path



8
9
10
# File 'lib/circleci/coverage_reporter/artifact.rb', line 8

def path
  @path
end

#urlString

URL of the artifact

Returns:

  • (String)

    the current value of url



8
9
10
# File 'lib/circleci/coverage_reporter/artifact.rb', line 8

def url
  @url
end

Instance Method Details

#bodyString

Returns content of the artifact.

Returns:

  • (String)

    content of the artifact



17
18
19
# File 'lib/circleci/coverage_reporter/artifact.rb', line 17

def body
  @body ||= CoverageReporter.client.get(url).body
end

#match?(value, node_index: nil) ⇒ Boolean

Parameters:

  • value (String)
  • node_index (Integer, nil) (defaults to: nil)

Returns:

  • (Boolean)


12
13
14
# File 'lib/circleci/coverage_reporter/artifact.rb', line 12

def match?(value, node_index: nil)
  path.end_with?(value) && (node_index.nil? || self.node_index == node_index)
end