Class: Semver::Identifier Private
- Inherits:
-
Object
- Object
- Semver::Identifier
- Defined in:
- lib/semver/identifier.rb
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.
Instance Attribute Summary collapse
- #value ⇒ String, Integer readonly private
Class Method Summary collapse
- .new(value) ⇒ Object private
Instance Method Summary collapse
-
#<=>(other) ⇒ Integer
private
Returns -1, 0, or 1.
-
#initialize(value) ⇒ Identifier
constructor
private
A new instance of Identifier.
Constructor Details
#initialize(value) ⇒ Identifier
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 Identifier.
8 9 10 |
# File 'lib/semver/identifier.rb', line 8 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ String, Integer (readonly)
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.
13 14 15 |
# File 'lib/semver/identifier.rb', line 13 def value @value end |
Class Method Details
.new(value) ⇒ 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.
27 28 29 30 31 |
# File 'lib/semver/identifier.rb', line 27 def self.new(value) identifier = allocate identifier.send(:initialize, value =~ /^\d+$/ ? value.to_i : value) identifier end |
Instance Method Details
#<=>(other) ⇒ Integer
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 -1, 0, or 1.
16 17 18 19 20 21 22 23 24 |
# File 'lib/semver/identifier.rb', line 16 def <=>(other) if other.value.is_a?(value.class) value <=> other.value elsif value.is_a?(Integer) -1 else 1 end end |