Sha256: a3798d22282de130266e5cc33202efe9a4213a0e6102707fb8ac99017e135ea7

Contents?: true

Size: 632 Bytes

Versions: 3

Compression:

Stored size: 632 Bytes

Contents

module Lutaml
  module Model
    module Validation
      def validate
        errors = []
        self.class.attributes.each do |name, attr|
          value = instance_variable_get(:"@#{name}")
          begin
            attr.validate_value!(value)
          rescue Lutaml::Model::InvalidValueError,
                 Lutaml::Model::CollectionCountOutOfRangeError,
                 PatternNotMatchedError => e
            errors << e
          end
        end
        errors
      end

      def validate!
        errors = validate
        raise Lutaml::Model::ValidationError.new(errors) if errors.any?
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lutaml-model-0.3.28 lib/lutaml/model/validation.rb
lutaml-model-0.3.27 lib/lutaml/model/validation.rb
lutaml-model-0.3.26 lib/lutaml/model/validation.rb