Sha256: 3dc6ae409e0c04e954f7831af6768edcea3d6a4acb185550bdb6bf69531a230f
Contents?: true
Size: 453 Bytes
Versions: 30
Compression:
Stored size: 453 Bytes
Contents
# frozen_string_literal: true module EnvSettings def env_prefix(new_prefix = nil) @env_prefix = new_prefix if new_prefix @env_prefix end def from_env(*method_names) builder = Sinclair.new(self) method_names.each do |method_name| env_key = [env_prefix, method_name].compact.join('_').upcase builder.add_class_method(method_name, cached: true) do ENV[env_key] end builder.build end end end
Version data entries
30 entries across 30 versions & 1 rubygems