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
4 5 6 |
# File 'lib/compact_index/gem_version.rb', line 4 def checksum @checksum end |
#dependencies ⇒ Object
Returns the value of attribute dependencies
4 5 6 |
# File 'lib/compact_index/gem_version.rb', line 4 def dependencies @dependencies end |
#info_checksum ⇒ Object
Returns the value of attribute info_checksum
4 5 6 |
# File 'lib/compact_index/gem_version.rb', line 4 def info_checksum @info_checksum end |
#number ⇒ Object
Returns the value of attribute number
4 5 6 |
# File 'lib/compact_index/gem_version.rb', line 4 def number @number end |
#platform ⇒ Object
Returns the value of attribute platform
4 5 6 |
# File 'lib/compact_index/gem_version.rb', line 4 def platform @platform end |
#ruby_version ⇒ Object
Returns the value of attribute ruby_version
4 5 6 |
# File 'lib/compact_index/gem_version.rb', line 4 def ruby_version @ruby_version end |
#rubygems_version ⇒ Object
Returns the value of attribute rubygems_version
4 5 6 |
# File 'lib/compact_index/gem_version.rb', line 4 def rubygems_version @rubygems_version end |
Instance Method Details
#<=>(other) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/compact_index/gem_version.rb', line 14 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
6 7 8 9 10 11 12 |
# File 'lib/compact_index/gem_version.rb', line 6 def number_and_platform if platform.nil? || platform == "ruby" number else "#{number}-#{platform}" end end |
#to_line ⇒ Object
24 25 26 27 28 29 |
# File 'lib/compact_index/gem_version.rb', line 24 def to_line line = "#{number_and_platform} #{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 |