Class: CompactIndex::GemVersion
- Inherits:
-
Struct
- Object
- Struct
- CompactIndex::GemVersion
- Defined in:
- lib/compact_index/gem_version.rb
Instance Attribute Summary collapse
-
#checksum ⇒ Object
Returns the value of attribute checksum.
-
#dependencies ⇒ Object
Returns the value of attribute dependencies.
-
#info_checksum ⇒ Object
Returns the value of attribute info_checksum.
-
#number ⇒ Object
Returns the value of attribute number.
-
#platform ⇒ Object
Returns the value of attribute platform.
-
#ruby_version ⇒ Object
Returns the value of attribute ruby_version.
-
#rubygems_version ⇒ Object
Returns the value of attribute rubygems_version.
Instance Method Summary collapse
Instance Attribute Details
#checksum ⇒ Object
Returns the value of attribute checksum
3 4 5 |
# File 'lib/compact_index/gem_version.rb', line 3 def checksum @checksum end |
#dependencies ⇒ Object
Returns the value of attribute dependencies
3 4 5 |
# File 'lib/compact_index/gem_version.rb', line 3 def dependencies @dependencies end |
#info_checksum ⇒ Object
Returns the value of attribute info_checksum
3 4 5 |
# File 'lib/compact_index/gem_version.rb', line 3 def info_checksum @info_checksum end |
#number ⇒ Object
Returns the value of attribute number
3 4 5 |
# File 'lib/compact_index/gem_version.rb', line 3 def number @number end |
#platform ⇒ Object
Returns the value of attribute platform
3 4 5 |
# File 'lib/compact_index/gem_version.rb', line 3 def platform @platform end |
#ruby_version ⇒ Object
Returns the value of attribute ruby_version
3 4 5 |
# File 'lib/compact_index/gem_version.rb', line 3 def ruby_version @ruby_version end |
#rubygems_version ⇒ Object
Returns the value of attribute rubygems_version
3 4 5 |
# File 'lib/compact_index/gem_version.rb', line 3 def rubygems_version @rubygems_version end |
Instance Method Details
#<=>(other) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/compact_index/gem_version.rb', line 13 def <=>(other) number_comp = number <=> other.number if number_comp.zero? [number, platform].compact <=> [other.number, other.platform].compact else number_comp end end |
#number_and_platform ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/compact_index/gem_version.rb', line 5 def number_and_platform if platform.nil? || platform == "ruby" number.dup else "#{number}-#{platform}" end end |
#to_line ⇒ Object
23 24 25 26 27 28 |
# File 'lib/compact_index/gem_version.rb', line 23 def to_line line = number_and_platform.dup << " " << deps_line << "|checksum:#{checksum}" line << ",ruby:#{ruby_version}" if ruby_version && ruby_version != ">= 0" line << ",rubygems:#{rubygems_version}" if rubygems_version && rubygems_version != ">= 0" line end |