Method: Inspec::Requirement#source_satisfies_spec?

Defined in:
lib/inspec/dependencies/requirement.rb

#source_satisfies_spec?Boolean

Returns:

  • (Boolean)


72
73
74
75
76
77
78
79
80
# File 'lib/inspec/dependencies/requirement.rb', line 72

def source_satisfies_spec?
  return true if version_constraints.empty?

  # Semverse::Constraint.satisfy_all returns a list of versions that match all of the
  # supplied constraints. Since we're only matching against a single version, the return
  # of satisfy_all will be non-empty if the profile version we have satisfies the constraints.
  constraints = @version_constraints.map { |x| Semverse::Constraint.new(x) }
  !Semverse::Constraint.satisfy_all(constraints, Semverse::Version.new(profile.version)).empty?
end