Class: XmlLaborabrechnungsdaten::Document

Inherits:
Object
  • Object
show all
Includes:
MemberContainer
Defined in:
lib/xml_laborabrechnungsdaten.rb

Constant Summary collapse

DEFAULT_SCHEMA_LOCATION =
"Laborabrechnungsdaten_(KZBV-VDZI-VDDS)_(V4-5).xsd"
UTF8_BOM =
"\xEF\xBB\xBF"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MemberContainer

#[], #[]=, included, #initialize, #members

Instance Attribute Details

#bomBoolean

Returns prepend UTF-8 BOM (EF BB BF); default false.

Returns:

  • (Boolean)

    prepend UTF-8 BOM (EF BB BF); default false



34
# File 'lib/xml_laborabrechnungsdaten.rb', line 34

member :bom, type: [TrueClass, FalseClass], default: false

#line_endingsSymbol

Returns :lf (default) or :crlf for Windows compatibility.

Returns:

  • (Symbol)

    :lf (default) or :crlf for Windows compatibility



30
# File 'lib/xml_laborabrechnungsdaten.rb', line 30

member :line_endings, type: Symbol, default: :lf

#rechnungRechnung

Returns The invoice details.

Returns:



22
# File 'lib/xml_laborabrechnungsdaten.rb', line 22

member :rechnung, type: Rechnung

#schema_locationString?

Returns xsi:noNamespaceSchemaLocation value; set to nil to omit the attribute.

Returns:

  • (String, nil)

    xsi:noNamespaceSchemaLocation value; set to nil to omit the attribute



26
# File 'lib/xml_laborabrechnungsdaten.rb', line 26

member :schema_location, type: String, default: DEFAULT_SCHEMA_LOCATION

#versionString

Returns Version of the XML schema.

Returns:

  • (String)

    Version of the XML schema



16
# File 'lib/xml_laborabrechnungsdaten.rb', line 16

member :version, type: String, default: "4.5"

Instance Method Details

#to_xml(indent: 2, target: "") ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/xml_laborabrechnungsdaten.rb', line 38

def to_xml(indent: 2, target: "")
  xml = Builder::XmlMarkup.new(indent: indent, target: target)
  xml.instruct! :xml, version: "1.0", encoding: "UTF-8"

  root_attrs = {}
  root_attrs["xsi:noNamespaceSchemaLocation"] = schema_location if schema_location
  root_attrs["xmlns:xsi"] = "http://www.w3.org/2001/XMLSchema-instance"
  root_attrs["Version"] = version

  xml.Laborabrechnung(root_attrs) do
    rechnung&.to_xml(xml)
  end

  target.gsub!("\n", "\r\n") if line_endings == :crlf
  bom ? UTF8_BOM + target : target
end