Sha256: c6ac19935b172572faf7e2fdfbd9b732606066d38f01403976cd2cccf945d2dc

Contents?: true

Size: 591 Bytes

Versions: 16

Compression:

Stored size: 591 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 => 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

16 entries across 16 versions & 1 rubygems

Version Path
lutaml-model-0.3.25 lib/lutaml/model/validation.rb
lutaml-model-0.3.24 lib/lutaml/model/validation.rb
lutaml-model-0.3.23 lib/lutaml/model/validation.rb
lutaml-model-0.3.22 lib/lutaml/model/validation.rb
lutaml-model-0.3.21 lib/lutaml/model/validation.rb
lutaml-model-0.3.20 lib/lutaml/model/validation.rb
lutaml-model-0.3.19 lib/lutaml/model/validation.rb
lutaml-model-0.3.18 lib/lutaml/model/validation.rb
lutaml-model-0.3.17 lib/lutaml/model/validation.rb
lutaml-model-0.3.16 lib/lutaml/model/validation.rb
lutaml-model-0.3.15 lib/lutaml/model/validation.rb
lutaml-model-0.3.14 lib/lutaml/model/validation.rb
lutaml-model-0.3.13 lib/lutaml/model/validation.rb
lutaml-model-0.3.12 lib/lutaml/model/validation.rb
lutaml-model-0.3.11 lib/lutaml/model/validation.rb
lutaml-model-0.3.10 lib/lutaml/model/validation.rb