Class: CreateGithubRelease::CommandLine::Validator Private
- Inherits:
-
Object
- Object
- CreateGithubRelease::CommandLine::Validator
- Defined in:
- lib/create_github_release/command_line/validator.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Validates a set of options after the options have been fully initialized
Instance Method Summary collapse
-
#errors ⇒ Array<String>
private
Returns an array of error messages.
-
#initialize(options) ⇒ Validator
constructor
private
Create a new instance of this class.
-
#valid? ⇒ Boolean
private
Returns
true
if all options are valid andfalse
otherwise.
Constructor Details
#initialize(options) ⇒ Validator
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a new instance of this class
13 14 15 |
# File 'lib/create_github_release/command_line/validator.rb', line 13 def initialize() @options = end |
Instance Method Details
#errors ⇒ Array<String>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns an array of error messages
- If the options are valid, returns an empty array
- If the options are not valid, returns an array of error messages
68 69 70 71 |
# File 'lib/create_github_release/command_line/validator.rb', line 68 def errors valid? @errors end |
#valid? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns true
if all options are valid and false
otherwise
- If the options are valid, returns
true
clears the#errors
array - If the options are not valid, returns
false
and populates the#errors
array
36 37 38 39 40 41 42 43 |
# File 'lib/create_github_release/command_line/validator.rb', line 36 def valid? @errors = [] validation_classes.each do |validation_class| validation = validation_class.new() @errors << validation.error unless validation.valid? end @errors.empty? end |