Class: Oscal::V1_2_1::RelatedTaskIdentifiedSubject

Inherits:
Base
  • Object
show all
Defined in:
lib/oscal/v1_2_1/all_models.rb

Instance Method Summary collapse

Methods inherited from Base

lutaml_default_register

Instance Method Details

#json_to_asm_assessment_subject_subjects(instance, doc) ⇒ Object



6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
# File 'lib/oscal/v1_2_1/all_models.rb', line 6580

def json_to_asm_assessment_subject_subjects(instance, doc)
  current = instance.instance_variable_get(:@assessment_subject)
  if current.is_a?(Array)
    doc["subjects"] = current.map { |item| item.respond_to?(:content) ? item.content : item }
  elsif current
    if current.is_a?(Lutaml::Model::Serializable)
      doc["subjects"] = Oscal::V1_2_1::AssessmentSubject.as_json(current)
    else
      val = current.respond_to?(:content) ? current.content : current
      doc["subjects"] = val
    end
  end
end

#validate_occurrencesObject



6594
6595
6596
# File 'lib/oscal/v1_2_1/all_models.rb', line 6594

def validate_occurrences
  Metaschema::ConstraintValidator.validate_occurrences(self, self.class.instance_variable_get(:@occurrence_constraints))
end