Method: Schash::Schema::Rule::OneOfTypes#validate
- Defined in:
- lib/schash/schema/rule/one_of_types.rb
#validate(target, position = []) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/schash/schema/rule/one_of_types.rb', line 9 def validate(target, position = []) match = @klasses.any? do |klass| target.is_a?(klass) end if match [] else [Error.new(position, "is not any of #{@klasses.map(&:to_s).join(', ')}")] end end |