Exception: Otoroshi::Collection::OneOfError
- Defined in:
- lib/otoroshi/exceptions.rb
Overview
Manages errors raised when at least one element of the collection 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.
71 72 73 74 75 76 |
# File 'lib/otoroshi/exceptions.rb', line 71 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} contains elements that are not in [#{list}]" end |