Class: Rosette::Core::Validators::CommitsValidator

Inherits:
CommitValidator show all
Defined in:
lib/rosette/core/validators/commits_validator.rb

Overview

Validates the existence of an array of commits.

Examples:

v = CommitsValidator.new
v.valid?(['73cd130a42017d794ffa86ef0d255541d518a7b3'], 'my_repo', config)
# => true

v.valid?(['non-existent-ref'], 'my_repo', config)
# => false

v.messages  # => ["Unable to find commit 'non-existent-ref'."]

Instance Attribute Summary

Attributes inherited from Validator

#options

Instance Method Summary collapse

Methods inherited from Validator

#initialize, #messages

Constructor Details

This class inherits a constructor from Rosette::Core::Validators::Validator

Instance Method Details

#valid?(commit_strs, repo_name, configuration) ⇒ Boolean

Returns:

  • (Boolean)

19
20
21
22
23
24
25
26
27
# File 'lib/rosette/core/validators/commits_validator.rb', line 19

def valid?(commit_strs, repo_name, configuration)
  if commit_strs
    commit_strs.all? do |commit_str|
      super(commit_str, repo_name, configuration)
    end
  else
    false
  end
end