module Diplo::Env
Public Instance Methods
fetch(variable) { || ... }
click to toggle source
# File lib/diplo/env.rb, line 9 def fetch(variable) ENV["DIPLO_#{variable.to_s.upcase}"] || begin yield if block_given? end end
fetch_converted(variable, conversion, error = nil) { || ... }
click to toggle source
# File lib/diplo/env.rb, line 23 def fetch_converted(variable, conversion, error = nil) value = fetch(variable) return yield if value.nil? && block_given? send conversion, value rescue error ? raise(error) : raise end
fetch_float(variable, error = nil, &block)
click to toggle source
# File lib/diplo/env.rb, line 19 def fetch_float(variable, error = nil, &block) fetch_converted variable, :Float, error, &block end
fetch_int(variable, error = nil, &block)
click to toggle source
# File lib/diplo/env.rb, line 15 def fetch_int(variable, error = nil, &block) fetch_converted variable, :Integer, error, &block end