Class: CreateGithubRelease::CommandLine::Validations::ValidatePreFlag Private

Inherits:
Base
  • Object
show all
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 that pre is unset or is set with the appropriate release types

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from CreateGithubRelease::CommandLine::Validations::Base

Instance Method Details

#errorString+

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

Returns:

  • (String, Array<String>)


85
86
87
# File 'lib/create_github_release/command_line/validations.rb', line 85

def error
  '--pre can only be given with a release type of major, minor, or patch'
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

Returns:

  • (Boolean)


78
79
80
# File 'lib/create_github_release/command_line/validations.rb', line 78

def valid?
  options.pre == false || %w[major minor patch].include?(options.release_type)
end