Class: Ibex::ArtifactSet

Inherits:
Object
  • Object
show all
Includes:
Enumerable, Enumerable[Artifact]
Defined in:
lib/ibex/artifact_set.rb,
sig/ibex/artifact_set.rbs

Overview

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

Instance Method Summary collapse

Constructor Details

#initializeArtifactSet

Returns a new instance of ArtifactSet.

RBS:

  • () -> void



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) ⇒ Artifact

RBS:

  • (kind: Symbol, path: String, content: String, ?mode: Integer?) -> Artifact

Parameters:

  • kind: (Symbol)
  • path: (String)
  • content: (String)
  • mode: (Integer, nil) (defaults to: nil)

Returns:



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

#eachEnumerator[Artifact, ArtifactSet] #eachArtifactSet

Overloads:

RBS:

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

Yields:

Yield Parameters:

Yield Returns:

  • (void)


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

RBS:

  • () -> bool

Returns:

  • (Boolean)


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

def empty?
  @artifacts.empty?
end

#to_aArray[Artifact]

RBS:

  • () -> Array[Artifact]

Returns:



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

def to_a
  @artifacts.dup
end