Module: Upfluence::Utils::EnvHelper
- Defined in:
- lib/upfluence/utils/env_helper.rb
Constant Summary collapse
- TRUTHY_ENV_VALUES =
%w[t true yes y 1 on].freeze
- FALSY_ENV_VALUES =
%w[f false no n 0 off].freeze
Class Method Summary collapse
Class Method Details
.env_to_bool(value, strict: false) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/upfluence/utils/env_helper.rb', line 9 def self.env_to_bool(value, strict: false) value = value.to_s normalized = value.downcase return false if FALSY_ENV_VALUES.include?(normalized) return true if TRUTHY_ENV_VALUES.include?(normalized) strict ? nil : !(value.nil? || value.empty?) end |