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 Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**attributes) ⇒ Footer

Returns a new instance of Footer.



22
23
24
25
# File 'lib/uniword/footer.rb', line 22

def initialize(**attributes)
  super
  validate_type
end

Instance Attribute Details

#mc_ignorableObject

mc:Ignorable prefix list carried to the serialized Wordprocessingml footer part (set by the reconciler).



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

def mc_ignorable
  @mc_ignorable
end

Instance Method Details

#elementsObject

Get all content elements (paragraphs and tables) in order



28
29
30
31
32
# File 'lib/uniword/footer.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 footer is empty

Returns:

  • (Boolean)


35
36
37
# File 'lib/uniword/footer.rb', line 35

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