3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'app/helpers/anchor/fetch_or_fallback_helper.rb', line 3
def fetch_or_fallback(allowed_values, given_value, fallback = nil)
if allowed_values.include?(given_value)
given_value
else
unless Rails.env.production?
raise ArgumentError, " fetch_or_fallback was called with an invalid value.\n Expected one of: \#{allowed_values.inspect}\n Got: \#{given_value.inspect}\n This will not raise in production, but will instead fallback to: \#{fallback.inspect}\n MSG\n end\n\n fallback\n end\nend\n"
|