Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有一种干净的方法可以从 .gemspec 文件中提取版本字符串?(gem 尚未安装)
例如 somethingcool.gemspec 是
Gem::Specification.new do |s| s.name = "somethingcool" s.version = "1.2.3" ... etc ... end
我想提取“1.2.3”。
我可以解决它,但必须有更好的方法。
require "rubygems" spec = Gem::Specification::load("example.gemspec") puts spec.version