Class: Dragnet::Validators::Entities::RepoValidator
- Inherits:
-
Object
- Object
- Dragnet::Validators::Entities::RepoValidator
- Defined in:
- lib/dragnet/validators/entities/repo_validator.rb
Overview
Validates a Dragnet::Repo
object, by checking its attributes.
Instance Attribute Summary collapse
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Instance Method Summary collapse
-
#initialize(repo) ⇒ RepoValidator
constructor
A new instance of RepoValidator.
-
#validate ⇒ Object
Validates the instance of the
Dragnet::Repo
object by checking each of its attributes.
Constructor Details
#initialize(repo) ⇒ RepoValidator
Returns a new instance of RepoValidator.
15 16 17 |
# File 'lib/dragnet/validators/entities/repo_validator.rb', line 15 def initialize(repo) @repo = repo end |
Instance Attribute Details
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
12 13 14 |
# File 'lib/dragnet/validators/entities/repo_validator.rb', line 12 def repo @repo end |
Instance Method Details
#validate ⇒ Object
Validates the instance of the Dragnet::Repo
object by checking each of its attributes.
23 24 25 26 27 |
# File 'lib/dragnet/validators/entities/repo_validator.rb', line 23 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 |