3
4
5
6
7
8
9
10
11
12
13
|
# File 'lib/environment_helpers/range_helpers.rb', line 3
def integer_range(name, default: nil, required: false)
check_default_type(:integer_range, default, Range)
check_range_endpoint(:integer_range, default.begin) if default
check_range_endpoint(:integer_range, default.end) if default
text = fetch_value(name, required: required)
range = text ? parse_range_from(text) : nil
return range if range
return default unless required
fail(InvalidRangeText, "Required Integer Range environment variable #{name} had inappropriate content '#{text}'")
end
|