Class: CreateGithubRelease::CommandLine::Validations::ValidatePreType Private
- Defined in:
- lib/create_github_release/command_line/validations.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.
Validate if pre_type is nil or releast_type is 'pre' or the pre flag is set
Instance Method Summary collapse
-
#error ⇒ String+
private
Called when valid? is
false
to return the error messages. -
#valid? ⇒ Boolean
private
Returns
true
if valid.
Methods inherited from Base
Constructor Details
This class inherits a constructor from CreateGithubRelease::CommandLine::Validations::Base
Instance Method Details
#error ⇒ 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.
Called when valid? is false
to return the error messages
106 107 108 109 110 111 112 |
# File 'lib/create_github_release/command_line/validations.rb', line 106 def error if %w[major minor patch pre].include?(.release_type) '--pre must be given when --pre-type is given' else '--pre-type can only be given with a release type of major, minor, patch, or pre' end 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 valid
97 98 99 100 101 |
# File 'lib/create_github_release/command_line/validations.rb', line 97 def valid? .pre_type.nil? || .release_type == 'pre' || (%w[major minor patch].include?(.release_type) && .pre == true) end |