Class: CircleCI::Parallel::Build

Inherits:
Object
  • Object
show all
Defined in:
lib/circleci/parallel/build.rb

Overview

Represents a CircleCI build.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(number, node_count) ⇒ Build

Returns a new instance of Build.

Parameters:

  • number (Integer)

    the build number (CIRCLE_BUILD_NUM)

  • node_count (Integer)

    node count of the build (CIRCLE_NODE_TOTAL)



11
12
13
14
# File 'lib/circleci/parallel/build.rb', line 11

def initialize(number, node_count)
  @number = number
  @node_count = node_count
end

Instance Attribute Details

#node_countObject (readonly)

Returns the value of attribute node_count.



7
8
9
# File 'lib/circleci/parallel/build.rb', line 7

def node_count
  @node_count
end

#numberObject (readonly)

Returns the value of attribute number.



7
8
9
# File 'lib/circleci/parallel/build.rb', line 7

def number
  @number
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



16
17
18
# File 'lib/circleci/parallel/build.rb', line 16

def ==(other)
  number == other.number
end

#hashObject



22
23
24
# File 'lib/circleci/parallel/build.rb', line 22

def hash
  number.hash ^ node_count.hash
end

#nodesArray<Node>

Returns nodes of the build.

Returns:

  • (Array<Node>)

    nodes of the build



27
28
29
# File 'lib/circleci/parallel/build.rb', line 27

def nodes
  @nodes ||= Array.new(node_count) { |index| Node.new(self, index) }.freeze
end