I'm using Ruby 1.9.2 (Yarv开发者_运维知识库).
When I install gems I just use "gem install ".
How can I know which Ruby version they are written in: 1.8.7, 1.9.1 or 1.9.2?
If I'm using the latest version and I install a gem that is written in 1.8.7, then that gem doesn't work?
Eg. Yardstick gem seems to not work with 1.9.2 but perfectly with 1.8.7.
How do you check what version each gem is using?
Could someone enlighten this topic for me.
Unfortunatelly there is no definitive way to check that as there are so many versions and variants or Ruby interpreters (Ruby, JRuby, Iron Ruby) and system platforms. Also one gem which is pure Ruby may not work on all platforms with same interpereter verson, because some OS specific properties could be used.
So you must trust the autor or docs he/she provided. Another way to make sure that your platform is right for gem just run tests enclosed to gem - every well written gem should have such.
There is also small tip: if file contains
# -*- encoding: utf-8 -*-
then autor probably developed the gem with 1.9.x in mind.
There's a website for answering the question: "Is it Ruby 1.9?"
http://isitruby19.com/
It doesn't look like anyone has reported on Yardstick yet: http://isitruby19.com/yardstick
You could be the first, and report that it's broken in 1.9.
精彩评论