Sha256: 0d0881b59ab793737f0dd604f28101ca74ae07fc27a1a07d6c66e23f9de88902
Contents?: true
Size: 689 Bytes
Versions: 5
Compression:
Stored size: 689 Bytes
Contents
module Pliny module ConfigHelpers def optional(*attrs) attrs.each do |attr| instance_eval "def #{attr}; @#{attr} ||= ENV['#{attr.upcase}'] end", __FILE__, __LINE__ end end def mandatory(*attrs) attrs.each do |attr| instance_eval "def #{attr}; @#{attr} ||= ENV['#{attr.upcase}'] || raise('missing=#{attr.upcase}') end", __FILE__, __LINE__ end end def override(attrs) attrs.each do |attr, value| instance_eval "def #{attr}; @#{attr} ||= ENV['#{attr.upcase}'] || '#{value}'.to_s end", __FILE__, __LINE__ end end end end # Supress the "use RbConfig instead" warning. Object.send :remove_const, :Config
Version data entries
5 entries across 5 versions & 1 rubygems