Class: Oscal::V1_2_1::ResponsibleRole

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_from_party_uuid_party_uuids(instance, value) ⇒ Object



9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
# File 'lib/oscal/v1_2_1/all_models.rb', line 9236

def json_from_party_uuid_party_uuids(instance, value)
  if value.is_a?(Array)
    parsed = value.map { |v| Oscal::V1_2_1::PartyUuid.of_json(v) }
    instance.instance_variable_set(:@party_uuid, parsed)
  elsif value.is_a?(Hash)
    if value.empty?
      inst = Oscal::V1_2_1::PartyUuid.new(content: "")
      instance.instance_variable_set(:@party_uuid, inst)
    else
      instance.instance_variable_set(:@party_uuid, Oscal::V1_2_1::PartyUuid.of_json(value))
    end
  elsif value
    instance.instance_variable_set(:@party_uuid, Oscal::V1_2_1::PartyUuid.of_json(value))
  end
end

#json_from_remarks_remarks(instance, value) ⇒ Object



9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
# File 'lib/oscal/v1_2_1/all_models.rb', line 9266

def json_from_remarks_remarks(instance, value)
  if value.is_a?(Array)
    parsed = value.map { |v| Oscal::V1_2_1::Remarks.of_json(v) }
    instance.instance_variable_set(:@remarks, parsed)
  elsif value.is_a?(Hash)
    if value.empty?
      inst = Oscal::V1_2_1::Remarks.new(content: "")
      instance.instance_variable_set(:@remarks, inst)
    else
      instance.instance_variable_set(:@remarks, Oscal::V1_2_1::Remarks.of_json(value))
    end
  elsif value
    instance.instance_variable_set(:@remarks, Oscal::V1_2_1::Remarks.of_json(value))
  end
end

#json_to_party_uuid_party_uuids(instance, doc) ⇒ Object



9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
# File 'lib/oscal/v1_2_1/all_models.rb', line 9252

def json_to_party_uuid_party_uuids(instance, doc)
  current = instance.instance_variable_get(:@party_uuid)
  if current.is_a?(Array)
    doc["party-uuids"] = current.map { |item| item.respond_to?(:content) ? item.content : item }
  elsif current
    if current.is_a?(Lutaml::Model::Serializable)
      doc["party-uuids"] = Oscal::V1_2_1::PartyUuid.as_json(current)
    else
      val = current.respond_to?(:content) ? current.content : current
      doc["party-uuids"] = val
    end
  end
end

#json_to_remarks_remarks(instance, doc) ⇒ Object



9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
# File 'lib/oscal/v1_2_1/all_models.rb', line 9282

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

#validate_occurrencesObject



9296
9297
9298
# File 'lib/oscal/v1_2_1/all_models.rb', line 9296

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