Class: Version::StemParser Private

Inherits:
RegexParser show all
Extended by:
T::Sig
Defined in:
version/parser.rb

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Constant Summary collapse

SOURCEFORGE_DOWNLOAD_REGEX =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

%r{(?:sourceforge\.net|sf\.net)/.*/download$}.freeze
NO_FILE_EXTENSION_REGEX =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

/\.[^a-zA-Z]+$/.freeze

Class Method Summary collapse

Methods inherited from RegexParser

#initialize, #parse

Methods inherited from Parser

#parse

Constructor Details

This class inherits a constructor from Version::RegexParser

Class Method Details

.process_spec(spec) ⇒ String

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

Returns:



62
63
64
65
66
67
68
69
70
# File 'version/parser.rb', line 62

def self.process_spec(spec)
  return spec.basename.to_s if spec.directory?

  spec_s = spec.to_s
  return spec.dirname.stem if spec_s.match?(SOURCEFORGE_DOWNLOAD_REGEX)
  return spec.basename.to_s if spec_s.match?(NO_FILE_EXTENSION_REGEX)

  spec.stem
end