Sha256: 727b18b56e141c0518f72404d523a0f92d5367ae8e4dbad11fdab0d0efe5f520
Contents?: true
Size: 555 Bytes
Versions: 2
Compression:
Stored size: 555 Bytes
Contents
require "easy-settings/path_source" class EasySettings::EnvSource < EasySettings::PathSource attr_reader :prefix def initialize(prefix, separator: "__", converter: :downcase, parse_values: true) @prefix = prefix super(nil, separator: separator, converter: converter, parse_values: parse_values) end def load {}.tap do |data| ENV.each do |variable, value| keys = variable.to_s.split(separator) next if prefix.present? && keys.shift != prefix assign_value(data, keys, value) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
easy-settings-1.3.0 | lib/easy-settings/env_source.rb |
easy-settings-1.2.0 | lib/easy-settings/env_source.rb |