Sha256: 3c7c69f0ab9c576d687f7bd26cfd1e526b9d08ae45b448aa04945909dc3d5289
Contents?: true
Size: 1.07 KB
Versions: 3
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true require_relative '../fields/sha1_validator' require_relative '../fields/files_validator' require_relative '../fields/path_validator' module Dragnet module Validators module Entities # Validates a +Dragnet::Repo+ object, by checking its attributes. class RepoValidator attr_reader :repo # @param [Dragnet::Repo] repo An instance of +Dragnet::Repo+ to validate. def initialize(repo) @repo = repo end # Validates the instance of the +Dragnet::Repo+ object by checking each # of its attributes. # @raise [Dragnet::Errors::ValidationError] If any of the fields in the # given +Dragnet::Repo+ object fails the validation. def validate Dragnet::Validators::Fields::SHA1Validator.new.validate('repos[sha1]', repo.sha1) Dragnet::Validators::Fields::PathValidator.new.validate('repos[path]', repo.path) repo.files = Dragnet::Validators::Fields::FilesValidator.new.validate('repos[files]', repo.files) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems