Class: Uniword::Footer

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/uniword/footer.rb

Overview

Represents a document footer Footers can contain paragraphs, tables, and fields (like page numbers)

Constant Summary collapse

TYPES =

Valid footer types

%w[default first even].freeze

Instance Method Summary collapse

Constructor Details

#initialize(**attributes) ⇒ Footer

Returns a new instance of Footer.



18
19
20
21
# File 'lib/uniword/footer.rb', line 18

def initialize(**attributes)
  super
  validate_type
end

Instance Method Details

#elementsObject

Get all content elements (paragraphs and tables) in order



24
25
26
27
28
# File 'lib/uniword/footer.rb', line 24

def elements
  (paragraphs + tables).sort_by do |elem|
    paragraphs.index(elem) || (tables.index(elem) + paragraphs.size)
  end
end

#empty?Boolean

Check if footer is empty

Returns:

  • (Boolean)


31
32
33
# File 'lib/uniword/footer.rb', line 31

def empty?
  paragraphs.empty? && tables.empty?
end