Module: Suture::Util::Env
- Defined in:
- lib/suture/util/env.rb
Class Method Summary collapse
Class Method Details
.sanitize_value(value) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/suture/util/env.rb', line 17 def self.sanitize_value(value) if value == "false" false elsif value == "true" true else value end end |
.to_map(excludes = {}) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/suture/util/env.rb', line 3 def self.to_map(excludes = {}) Hash[ ENV.keys. select { |k| k.start_with?("SUTURE_") }. map { |k| [to_sym(k), sanitize_value(ENV[k])] } ].reject { |(k,_)| excludes.include?(k) } end |
.to_sym(name) ⇒ Object
private
13 14 15 |
# File 'lib/suture/util/env.rb', line 13 def self.to_sym(name) name.gsub(/^SUTURE\_/,'').downcase.to_sym end |