Class: Version::NumericToken Private
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.
A token consisting of only numbers.
Constant Summary collapse
- PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
/[0-9]+/i.freeze
Instance Attribute Summary
Attributes inherited from Token
Instance Method Summary collapse
- #<=>(other) ⇒ Object private
-
#initialize(value) ⇒ NumericToken
constructor
private
A new instance of NumericToken.
- #numeric? ⇒ Boolean private
Methods inherited from Token
create, from, #hash, #inspect, #to_f, #to_i, #to_s
Constructor Details
#initialize(value) ⇒ NumericToken
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 a new instance of NumericToken.
137 138 139 140 141 |
# File 'Library/Homebrew/version.rb', line 137 def initialize(value) super @value = value.to_i end |
Instance Method Details
#<=>(other) ⇒ Object
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.
143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'Library/Homebrew/version.rb', line 143 def <=>(other) return unless other = Token.from(other) case other when NumericToken value <=> other.value when StringToken 1 when NullToken -Integer(other <=> self) end end |
#numeric? ⇒ 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.
156 157 158 |
# File 'Library/Homebrew/version.rb', line 156 def numeric? true end |