Check for Ruby Gem availability

后端 未结 7 1566
没有蜡笔的小新
没有蜡笔的小新 2020-12-02 12:15

Is there a way to check if some gem is currently installed, via the Gem module? From ruby code, not by executing \'gem list\'...

To clarify - I don\'t want to load t

相关标签:
7条回答
  • 2020-12-02 13:05

    Didn't see this anywhere here, but you can also pass fuzzy version strings to find_by_name and find_all_by_name:

    Gem::Specification.find_all_by_name('gemname', '>= 4.0').any?
    
    0 讨论(0)
提交回复
热议问题