Answers ( 1 )

  1. 2017-01-04 18:01

    Assuming that these are version strings, you could use Gem::Version and Gem::Requirement:

    requirement = Gem::Requirement.new('< 1.13')
    
    requirement.satisfied_by? Gem::Version.new('1.10.2.ab2-4.cl6') #=> true
    requirement.satisfied_by? Gem::Version.new('1.11.2.ab2-4.dl5') #=> true
    requirement.satisfied_by? Gem::Version.new('1.13.2.ab2-4.el6') #=> false
    
◀ Go back