Class: Niso::Jats::TableWrap

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/niso/jats/table_wrap.rb

Instance Method Summary collapse

Instance Method Details

#to_xml(options = {}) ⇒ Object

Override to_xml to skip empty oasis_table elements



86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/niso/jats/table_wrap.rb', line 86

def to_xml(options = {})
  # Temporarily remove empty oasis_tables before serialization
  original_oasis = @oasis_table
  if @oasis_table
    @oasis_table = @oasis_table.reject do |ot|
      ot.tgroups.nil? || ot.tgroups.empty?
    end
  end
  result = super
  @oasis_table = original_oasis
  result
end