エントリーの編集
エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
Ruby: require vs require_relative - best practice to workaround running in both Ruby <1.9.2 and >=1.9.2
記事へのコメント1件
- 注目コメント
- 新着コメント
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
Ruby: require vs require_relative - best practice to workaround running in both Ruby <1.9.2 and >=1.9.2
What is the best practice if I want to require a relative file in Ruby and I want it to work in b... What is the best practice if I want to require a relative file in Ruby and I want it to work in both 1.8.x and >=1.9.2? I see a few options: just do $LOAD_PATH << '.' and forget everything do $LOAD_PATH << File.dirname(__FILE__) require './path/to/file' check if RUBY_VERSION < 1.9.2, then define require_relative as require, use require_relative everywhere where it's needed afterwards check if requ



2012/12/06 リンク