Class: SemverDialects::Apk::VersionParser
- Inherits:
-
Object
- Object
- SemverDialects::Apk::VersionParser
- Defined in:
- lib/semver_dialects/apk.rb
Overview
rubocop:todo Style/Documentation
Constant Summary collapse
- DASH =
/-/- ALPHABETS =
/([a-zA-Z]+)/- DIGITS =
/([0-9]+)/- DIGIT =
/[0-9]/- DOT =
'.'- UNDERSCORE =
'_'- PRE_RELEASE_SUFFIXES =
%w[alpha beta pre rc].freeze
- POST_RELEASE_SUFFIXES =
%w[cvs svn git hg p].freeze
- WHITE_SPACE =
/\s/
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#scanner ⇒ Object
readonly
Returns the value of attribute scanner.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(input) ⇒ VersionParser
constructor
A new instance of VersionParser.
-
#parse ⇒ Object
Parse splits the raw version string into: version, pre_release, post_release and revision Format: <version>_<release>-<revision> Note that version segment can contain alphabets Release is always preceded with ‘_` Revision is always preceded with `-`.
Constructor Details
#initialize(input) ⇒ VersionParser
Returns a new instance of VersionParser.
137 138 139 140 141 142 143 |
# File 'lib/semver_dialects/apk.rb', line 137 def initialize(input) @input = input @pre_release = [] @post_release = [] @revision = [] @scanner = StringScanner.new(input) end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
135 136 137 |
# File 'lib/semver_dialects/apk.rb', line 135 def input @input end |
#scanner ⇒ Object (readonly)
Returns the value of attribute scanner.
135 136 137 |
# File 'lib/semver_dialects/apk.rb', line 135 def scanner @scanner end |
Class Method Details
.parse(input) ⇒ Object
131 132 133 |
# File 'lib/semver_dialects/apk.rb', line 131 def self.parse(input) new(input).parse end |
Instance Method Details
#parse ⇒ Object
Parse splits the raw version string into: version, pre_release, post_release and revision Format: <version>_<release>-<revision> Note that version segment can contain alphabets Release is always preceded with ‘_` Revision is always preceded with `-`
151 152 153 154 155 |
# File 'lib/semver_dialects/apk.rb', line 151 def parse tokens = parse_tokens Version.new(tokens, pre_release: @pre_release, post_release: @post_release, revision: @revision) end |