Exception: Lutaml::Model::PolymorphicError

Inherits:
Error
  • Object
show all
Defined in:
lib/lutaml/model/error/polymorphic_error.rb

Instance Method Summary collapse

Constructor Details

#initialize(value, options, type) ⇒ PolymorphicError

Returns a new instance of PolymorphicError.



4
5
6
7
8
9
10
11
# File 'lib/lutaml/model/error/polymorphic_error.rb', line 4

def initialize(value, options, type)
  error = if options[:polymorphic].is_a?(Array)
            "#{value.class} not in #{options[:polymorphic]}"
          else
            "#{value.class} is not valid sub class of #{type}"
          end
  super(error)
end