Class: Uniword::Header
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Uniword::Header
- Defined in:
- lib/uniword/header.rb
Overview
Represents a document header Headers can contain paragraphs and tables
Constant Summary collapse
- TYPES =
Valid header types
%w[default first even].freeze
Instance Attribute Summary collapse
-
#mc_ignorable ⇒ Object
mc:Ignorable prefix list carried to the serialized Wordprocessingml header part (set by the reconciler).
Instance Method Summary collapse
-
#elements ⇒ Object
Get all content elements (paragraphs and tables) in order.
-
#empty? ⇒ Boolean
Check if header is empty.
-
#initialize(**attributes) ⇒ Header
constructor
A new instance of Header.
Constructor Details
#initialize(**attributes) ⇒ Header
Returns a new instance of Header.
22 23 24 25 |
# File 'lib/uniword/header.rb', line 22 def initialize(**attributes) super validate_type end |
Instance Attribute Details
#mc_ignorable ⇒ Object
mc:Ignorable prefix list carried to the serialized Wordprocessingml header part (set by the reconciler).
17 18 19 |
# File 'lib/uniword/header.rb', line 17 def mc_ignorable @mc_ignorable end |
Instance Method Details
#elements ⇒ Object
Get all content elements (paragraphs and tables) in order
28 29 30 31 32 |
# File 'lib/uniword/header.rb', line 28 def elements (paragraphs + tables).sort_by do |elem| paragraphs.index(elem) || (tables.index(elem) + paragraphs.size) end end |
#empty? ⇒ Boolean
Check if header is empty
35 36 37 |
# File 'lib/uniword/header.rb', line 35 def empty? paragraphs.empty? && tables.empty? end |