From a84908b7e8a0e2423afd6b836eccf27a420270b4 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 20 Sep 2023 19:56:52 +0900 Subject: feat(blog/nuldoc): change content format from DocBook to NulDoc --- .../ruby-detect-running-implementation.ndoc | 118 +++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 vhosts/blog/content/posts/2021-10-02/ruby-detect-running-implementation.ndoc (limited to 'vhosts/blog/content/posts/2021-10-02/ruby-detect-running-implementation.ndoc') diff --git a/vhosts/blog/content/posts/2021-10-02/ruby-detect-running-implementation.ndoc b/vhosts/blog/content/posts/2021-10-02/ruby-detect-running-implementation.ndoc new file mode 100644 index 00000000..cd999882 --- /dev/null +++ b/vhosts/blog/content/posts/2021-10-02/ruby-detect-running-implementation.ndoc @@ -0,0 +1,118 @@ +--- +[article] +title = "【Ruby】 自身を実行している処理系の種類を判定する" +description = "Ruby には複数の実装があるが、自身を実行している処理系の種類をスクリプト上からどのように判定すればよいだろうか。" +tags = [ + "ruby", +] + +[[article.revisions]] +date = "2021-10-02" +remark = "Qiita から移植" +--- +
+ + この記事は Qiita から移植してきたものです。 + 元 URL: https://qiita.com/nsfisis/items/74d7ffeeebc51b20d791 + +

+ Ruby + という言語には複数の実装があるが、それらをスクリプト上からどのようにして + programmatically に見分ければよいだろうか。 +

+

+ Object クラスに定義されている RUBY_ENGINE + という定数がこの用途に使える。 +

+

+ 参考: + Object::RUBY_ENGINE +

+

+ 上記ページの例から引用する: +

+ + + +

+ それぞれの処理系がどのような値を返すかだが、stack overflow + に良い質問と回答があった。 +

+

+ What values for RUBY_ENGINE + correspond to which Ruby implementations? より引用: +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RUBY_ENGINEImplementation
<undefined>MRI < 1.9
`ruby'MRI >= 1.9 or REE
`jruby'JRuby
`macruby'MacRuby
`rbx'Rubinius
`maglev'MagLev
`ironruby'IronRuby
`cardinal'Cardinal
+
+

+ なお、この質問・回答は + 2014年になされたものであり、値は変わっている可能性がある。MRI (aka + CRuby) については執筆時現在 (2020/12/8) も 'ruby' + が返ってくることを確認済み。 +

+

+ この表にない主要な処理系として、https://mruby.org[mruby] は 'mruby' + を返す。 +

+

+ mruby + 該当部分のソース より引用: +

+ + + +
-- cgit v1.2.3-70-g09d2