6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ruby で定数を環境変数から取得したい、かつデフォルト値を定義したい

Posted at

文字列を取得したい場合

LOCALE = ENV['LOCALE'] || 'ja'

数値を取得したい場合

MAX_COUNT = (ENV["MAX_COUNT"] || 30).to_i
TIMEOUT = (ENV["TIMEOUT"] || 0.5).to_f
6
5
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?