Class: Ksef::FA3::Serializer::Element

Inherits:
Data
  • Object
show all
Defined in:
lib/ksef/fa3/serializer.rb

Overview

An element that carries attributes, and optionally nested elements of its own.

FA(3) has exactly two: KodFormularza, whose two attributes are fixed by the schema and which holds text; and Zalacznik/…/Kol, whose Typ is required but not fixed and which holds a nested NKom. The second is why children exists — this comment used to say the model did not carry Zalacznik, which stopped being true in the commit that added the member three lines below.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text: nil, attributes: {}, children: nil) ⇒ Element

children arrived with the attachment: Kol carries a required Typ attribute and a nested NKom, which nothing before it needed. They are written through Ksef::FA3::Serializer#write_children like any other nested element, so schema order and the unknown-key check apply inside an attributed element too rather than being bypassed.



38
39
40
# File 'lib/ksef/fa3/serializer.rb', line 38

def initialize(text: nil, attributes: {}, children: nil)
  super
end

Instance Attribute Details

#attributes ⇒ Object (readonly)

Returns the value of attribute attributes

Returns:

  • (Object) —

    the current value of attributes



33
34
35
# File 'lib/ksef/fa3/serializer.rb', line 33

def attributes
  @attributes
end

#children ⇒ Object (readonly)

Returns the value of attribute children

Returns:

  • (Object) —

    the current value of children



33
34
35
# File 'lib/ksef/fa3/serializer.rb', line 33

def children
  @children
end

#text ⇒ Object (readonly)

Returns the value of attribute text

Returns:

  • (Object) —

    the current value of text



33
34
35
# File 'lib/ksef/fa3/serializer.rb', line 33

def text
  @text
end