Class: Homebrew::Vulns::Match::ReconciledHistory Private

Inherits:
T::Struct
  • Object
show all
Defined in:
vulns/match.rb

Overview

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

A history decision, not permission to replace a stored record. Callers must also validate its provenance and observe every required platform.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(state:, intervals: [], reasons:) ⇒ void

Parameters:



# File ''

const :state, Symbol
const :intervals, T::Array[Interval], default: []

Instance Attribute Details

#intervals ⇒ Array<Interval> (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns the value of prop intervals.

Returns:



# File ''

const :intervals, T::Array[Interval], default: []

#reasons ⇒ Array<Symbol> (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns the value of prop reasons.

Returns:



# File ''

#state ⇒ Symbol (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns the value of prop state.

Returns:



# File ''

const :state, Symbol

Class Method Details

.combine(results) ⇒ ReconciledHistory

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

Returns:



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'vulns/match.rb', line 112

def self.combine(results)
  reasons = results.flat_map(&:reasons)
  reasons << :preserved if results.any? { |result| result.state == :preserved }
  if (results.empty? || results.any? do |result|
    [:range, :never_affected].exclude?(result.state)
  end) && reasons.empty?
    reasons << :unsupported_result
  end
  ranges = results.select { |result| result.state == :range }
  if ranges.any? { |result| result.intervals.empty? || result.intervals.any? { |interval| !interval.valid? } }
    reasons << :invalid_interval
  end
  return new(state: :unresolved, reasons: reasons.uniq.sort) if reasons.any?

  intervals = Interval.union(ranges.flat_map(&:intervals))
  new(state: intervals.empty? ? :never_affected : :range, intervals:, reasons: [])
end

Instance Method Details

#events ⇒ Array<Hash{Symbol => String}>

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:



109
# File 'vulns/match.rb', line 109

def events = intervals.flat_map(&:events)

#fixed ⇒ String?

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:



106
# File 'vulns/match.rb', line 106

def fixed = intervals.last&.fixed

#introduced ⇒ String?

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:



103
# File 'vulns/match.rb', line 103

def introduced = intervals.first&.introduced