Module: FunWith::VersionStrings::Comparator
- Defined in:
- lib/version_strings/comparator.rb
Instance Method Summary collapse
-
#<=>(rhs) ⇒ Object
Unless both strings are valid version formats, pass comparison off to super.
Instance Method Details
#<=>(rhs) ⇒ Object
Unless both strings are valid version formats, pass comparison off to super
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/version_strings/comparator.rb', line 6 def <=>( rhs ) if rhs.is_a?(VersionString) || rhs =~ VersionString::FORMAT_VALIDATOR rhs = rhs.fwvs_version_string for level in [:major, :minor, :patch] unless self.send(level) == rhs.send(level) return self.send(level) <=> rhs.send(level) end end return 0 else super( rhs ) end end |