Class: Ibex::ArtifactSet

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/ibex/artifact_set.rb

Overview

A generation's rendered outputs before any target is changed.

Instance Method Summary collapse

Constructor Details

#initializeArtifactSet

Returns a new instance of ArtifactSet.



31
32
33
# File 'lib/ibex/artifact_set.rb', line 31

def initialize
  @artifacts = [] #: Array[Artifact]
end

Instance Method Details

#add(kind:, path:, content:, mode: nil) ⇒ Object



36
37
38
39
40
# File 'lib/ibex/artifact_set.rb', line 36

def add(kind:, path:, content:, mode: nil)
  artifact = Artifact.new(kind: kind, path: path, content: content, mode: mode)
  @artifacts << artifact
  artifact
end

#each(&block) ⇒ Object

@rbs! def each: () -> Enumerator[Artifact, ArtifactSet] | () { (Artifact) -> void } -> ArtifactSet



46
47
48
49
50
51
# File 'lib/ibex/artifact_set.rb', line 46

def each(&block)
  return enum_for(:each) unless block

  @artifacts.each(&block)
  self
end

#empty?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/ibex/artifact_set.rb', line 59

def empty?
  @artifacts.empty?
end

#to_aObject



54
55
56
# File 'lib/ibex/artifact_set.rb', line 54

def to_a
  @artifacts.dup
end