2025-06-17 14:56:10 +01:00
|
|
|
# typed: strict
|
2022-10-08 01:08:15 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Cask
|
|
|
|
# Sorted set containing all cask artifacts.
|
|
|
|
class ArtifactSet < ::Set
|
2025-06-17 14:56:10 +01:00
|
|
|
extend T::Generic
|
|
|
|
|
|
|
|
Elem = type_member(:out) { { fixed: Artifact::AbstractArtifact } }
|
|
|
|
|
|
|
|
sig { params(block: T.nilable(T.proc.params(arg0: Elem).returns(T.untyped))).void }
|
2022-10-08 01:08:15 +01:00
|
|
|
def each(&block)
|
2023-02-22 09:11:29 -08:00
|
|
|
return enum_for(T.must(__method__)) { size } unless block
|
2022-10-08 01:08:15 +01:00
|
|
|
|
|
|
|
to_a.each(&block)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
2025-06-17 14:56:10 +01:00
|
|
|
sig { returns(T::Array[Artifact::AbstractArtifact]) }
|
2022-10-08 01:08:15 +01:00
|
|
|
def to_a
|
|
|
|
super.sort
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|