Skip to content

Commit fc7f9b2

Browse files
committed
Add Config::Options#split
1 parent 1f7bc91 commit fc7f9b2

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

lib/config/options.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ def reload_env!
3737
hash = Hash.new
3838

3939
ENV.each do |variable, value|
40-
keys = variable.to_s.split(Config.env_separator)
40+
keys = split(variable)
4141

42-
prefix = (Config.env_prefix || Config.const_name).to_s.split(Config.env_separator)
42+
prefix = split(Config.env_prefix || Config.const_name)
4343

4444
next if keys.shift(prefix.size) != prefix
4545

@@ -154,6 +154,10 @@ def []=(param, value)
154154

155155
protected
156156

157+
def split(string)
158+
string.to_s.split(Config.env_separator)
159+
end
160+
157161
def descend_array(array)
158162
array.map do |value|
159163
if value.instance_of? Config::Options

0 commit comments

Comments
 (0)