Class: Uniword::Wordprocessingml::NumberingLevel
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Uniword::Wordprocessingml::NumberingLevel
- Defined in:
- lib/uniword/wordprocessingml/numbering_level.rb
Overview
Represents a single level in a numbering definition Each level defines format, alignment, indentation, and start value
Constant Summary collapse
- FORMATS =
Valid numbering formats
%w[ decimal upperRoman lowerRoman upperLetter lowerLetter ordinal cardinalText ordinalText hex chicago bullet ].freeze
- ALIGNMENTS =
Valid alignment values
%w[left right center both].freeze
Instance Method Summary collapse
-
#bullet!(character, font_name: "Symbol") ⇒ Object
Set this level as a bullet with the given character.
-
#bullet? ⇒ Boolean
Check if this is a bullet level.
-
#initialize(attrs = {}) ⇒ NumberingLevel
constructor
A new instance of NumberingLevel.
-
#numbering_text ⇒ Object
Get the numbering text template Example: “%1.” for level 0, “%1.%2.” for level 1, etc.
Constructor Details
#initialize(attrs = {}) ⇒ NumberingLevel
Returns a new instance of NumberingLevel.
38 39 40 41 42 |
# File 'lib/uniword/wordprocessingml/numbering_level.rb', line 38 def initialize(attrs = {}) super validate_format validate_alignment end |
Instance Method Details
#bullet!(character, font_name: "Symbol") ⇒ Object
Set this level as a bullet with the given character
45 46 47 48 49 |
# File 'lib/uniword/wordprocessingml/numbering_level.rb', line 45 def bullet!(character, font_name: "Symbol") self.format = "bullet" self.text = character self.font_name = font_name end |
#bullet? ⇒ Boolean
Check if this is a bullet level
52 53 54 |
# File 'lib/uniword/wordprocessingml/numbering_level.rb', line 52 def bullet? format == "bullet" end |
#numbering_text ⇒ Object
Get the numbering text template Example: “%1.” for level 0, “%1.%2.” for level 1, etc.
58 59 60 61 62 |
# File 'lib/uniword/wordprocessingml/numbering_level.rb', line 58 def numbering_text return text if bullet? @text || default_numbering_text end |