Class: Oscal::V1_2_1::ModifyAlter

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_add_adds(instance, doc) ⇒ Object



1830
1831
1832
1833
1834
1835
1836
1837
# File 'lib/oscal/v1_2_1/all_models.rb', line 1830

def json_to_asm_add_adds(instance, doc)
  current = instance.instance_variable_get(:@add)
  if current.is_a?(Array)
    doc["adds"] = current.map { |item| item.respond_to?(:content) ? item.content : item }
  elsif current
    doc["adds"] = current.respond_to?(:content) ? current.content : current
  end
end

#json_to_asm_remove_removes(instance, doc) ⇒ Object



1821
1822
1823
1824
1825
1826
1827
1828
# File 'lib/oscal/v1_2_1/all_models.rb', line 1821

def json_to_asm_remove_removes(instance, doc)
  current = instance.instance_variable_get(:@remove)
  if current.is_a?(Array)
    doc["removes"] = current.map { |item| item.respond_to?(:content) ? item.content : item }
  elsif current
    doc["removes"] = current.respond_to?(:content) ? current.content : current
  end
end