Exception: Otoroshi::OneOfError
- Defined in:
- lib/otoroshi/exceptions.rb
Overview
Manages errors raised when value is not accepted (not in the “one_of”)
Instance Method Summary collapse
-
#initialize(property, values) ⇒ OneOfError
constructor
A new instance of OneOfError.
Constructor Details
#initialize(property, values) ⇒ OneOfError
Returns a new instance of OneOfError.
25 26 27 28 29 30 |
# File 'lib/otoroshi/exceptions.rb', line 25 def initialize(property, values) # reintegrate the colon for symbols which is lost during interpolation to_s = ->(v) { v.is_a?(Symbol) ? ":#{v}" : v } list = values.map { |v| to_s.call(v) }.join(', ') super ":#{property} is not in [#{list}]" end |