Class: Version::RegexParser Abstract Private
- Extended by:
- T::Helpers
- Defined in:
- version/parser.rb
Overview
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.
It cannot be directly instantiated. Subclasses must implement the abstract
methods below.
Direct Known Subclasses
Class Method Summary collapse
- .process_spec(spec) ⇒ String abstract private
Instance Method Summary collapse
- #initialize(regex, &block) ⇒ void constructor private
- #parse(spec) ⇒ String? private
Constructor Details
#initialize(regex, &block) ⇒ void
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.
18 19 20 21 22 |
# File 'version/parser.rb', line 18 def initialize(regex, &block) super() @regex = regex @block = block end |
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.
37 |
# File 'version/parser.rb', line 37 def self.process_spec(spec); end |
Instance Method Details
#parse(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.
25 26 27 28 29 30 31 32 33 34 |
# File 'version/parser.rb', line 25 def parse(spec) match = @regex.match(self.class.process_spec(spec)) return if match.blank? version = match.captures.first return if version.blank? return @block.call(version) if @block.present? version end |