Class: CompactIndex::GemVersion
- Inherits:
-
Struct
- Object
- Struct
- CompactIndex::GemVersion
- Defined in:
- lib/compact_index/gem_version.rb
Overview
rubocop:disable Metrics/BlockLength
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
5 6 7 |
# File 'lib/compact_index/gem_version.rb', line 5 def checksum @checksum end |
#dependencies ⇒ Object
Returns the value of attribute dependencies
5 6 7 |
# File 'lib/compact_index/gem_version.rb', line 5 def dependencies @dependencies end |
#info_checksum ⇒ Object
Returns the value of attribute info_checksum
5 6 7 |
# File 'lib/compact_index/gem_version.rb', line 5 def info_checksum @info_checksum end |
#number ⇒ Object
Returns the value of attribute number
5 6 7 |
# File 'lib/compact_index/gem_version.rb', line 5 def number @number end |
#platform ⇒ Object
Returns the value of attribute platform
5 6 7 |
# File 'lib/compact_index/gem_version.rb', line 5 def platform @platform end |
#ruby_version ⇒ Object
Returns the value of attribute ruby_version
5 6 7 |
# File 'lib/compact_index/gem_version.rb', line 5 def ruby_version @ruby_version end |
#rubygems_version ⇒ Object
Returns the value of attribute rubygems_version
5 6 7 |
# File 'lib/compact_index/gem_version.rb', line 5 def rubygems_version @rubygems_version end |
Instance Method Details
#<=>(other) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/compact_index/gem_version.rb', line 15 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
7 8 9 10 11 12 13 |
# File 'lib/compact_index/gem_version.rb', line 7 def number_and_platform if platform.nil? || platform == "ruby" number.dup else "#{number}-#{platform}" end end |
#to_line ⇒ Object
25 26 27 28 29 30 |
# File 'lib/compact_index/gem_version.rb', line 25 def to_line line = number_and_platform.dup << " " << deps_line << "|checksum:#{checksum}" line << ",ruby:#{ruby_version_line}" if ruby_version && ruby_version != ">= 0" line << ",rubygems:#{rubygems_version_line}" if rubygems_version && rubygems_version != ">= 0" line end |