Class: Version::Token Abstract Private
- Extended by:
- T::Helpers
- Includes:
- Comparable
- Defined in:
- version.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.
A part of a Version.
Direct Known Subclasses
Instance Attribute Summary collapse
- #value ⇒ String, ... readonly private
Class Method Summary collapse
- .create(val) ⇒ Token private
- .from(val) ⇒ Token? private
Instance Method Summary collapse
- #blank? ⇒ Boolean private
- #initialize(value) ⇒ void constructor private
- #null? ⇒ Boolean private
- #numeric? ⇒ Boolean private
- #to_f ⇒ Float private
- #to_i ⇒ Integer private
- #to_str ⇒ String private
Constructor Details
#initialize(value) ⇒ 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.
52 53 54 |
# File 'version.rb', line 52 def initialize(value) @value = T.let(value, T.untyped) end |
Instance Attribute Details
#value ⇒ String, ... (readonly)
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.
49 50 51 |
# File 'version.rb', line 49 def value @value end |
Class Method Details
.create(val) ⇒ Token
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.
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'version.rb', line 23 def self.create(val) case val when /\A#{AlphaToken::PATTERN}\z/o then AlphaToken when /\A#{BetaToken::PATTERN}\z/o then BetaToken when /\A#{RCToken::PATTERN}\z/o then RCToken when /\A#{PreToken::PATTERN}\z/o then PreToken when /\A#{PatchToken::PATTERN}\z/o then PatchToken when /\A#{PostToken::PATTERN}\z/o then PostToken when /\A#{NumericToken::PATTERN}\z/o then NumericToken when /\A#{StringToken::PATTERN}\z/o then StringToken else raise "Cannot find a matching token pattern" end.new(val) end |
.from(val) ⇒ Token?
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.
38 39 40 41 42 43 44 45 46 |
# File 'version.rb', line 38 def self.from(val) return NULL_TOKEN if val.nil? || (val.respond_to?(:null?) && val.null?) case val when Token then val when String then Token.create(val) when Integer then Token.create(val.to_s) end end |
Instance Method Details
#blank? ⇒ Boolean
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.
98 |
# File 'version.rb', line 98 def blank? = null? |
#null? ⇒ Boolean
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.
93 94 95 |
# File 'version.rb', line 93 def null? false end |
#numeric? ⇒ Boolean
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.
88 89 90 |
# File 'version.rb', line 88 def numeric? false end |
#to_f ⇒ Float
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.
70 71 72 |
# File 'version.rb', line 70 def to_f value.to_f end |
#to_i ⇒ Integer
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.
75 76 77 |
# File 'version.rb', line 75 def to_i value.to_i end |
#to_str ⇒ 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.
80 81 82 |
# File 'version.rb', line 80 def to_str value.to_s end |