Class: Uniword::LineNumbering
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Uniword::LineNumbering
- Defined in:
- lib/uniword/line_numbering.rb
Overview
Represents line numbering configuration for a section
Line numbering displays line numbers in the margin of a document section. It’s commonly used in legal documents and academic papers.
Constant Summary collapse
- RESTART_OPTIONS =
Restart options
%w[continuous newPage newSection].freeze
Instance Attribute Summary collapse
-
#count_by ⇒ Integer
Increment for numbering (e.g., 5 = 5, 10, 15…).
-
#distance ⇒ Integer
Distance from text in twips.
-
#restart ⇒ String
When to restart numbering.
-
#start ⇒ Integer
Starting line number.
Class Method Summary collapse
-
.continuous(count_by: 1, distance: 360) ⇒ LineNumbering
Create continuous line numbering (never restarts).
-
.per_page(count_by: 1, distance: 360) ⇒ LineNumbering
Create line numbering that restarts on each page.
-
.per_section(count_by: 1, distance: 360) ⇒ LineNumbering
Create line numbering that restarts on each section.
Instance Method Summary collapse
-
#continuous? ⇒ Boolean
Check if numbering is continuous (never restarts).
-
#initialize(**attributes) ⇒ LineNumbering
constructor
A new instance of LineNumbering.
-
#per_page? ⇒ Boolean
Check if numbering restarts on each page.
-
#per_section? ⇒ Boolean
Check if numbering restarts on each section.
Constructor Details
#initialize(**attributes) ⇒ LineNumbering
Returns a new instance of LineNumbering.
38 39 40 41 42 43 |
# File 'lib/uniword/line_numbering.rb', line 38 def initialize(**attributes) super validate_restart validate_start validate_count_by end |
Instance Attribute Details
#count_by ⇒ Integer
Increment for numbering (e.g., 5 = 5, 10, 15…)
29 30 31 |
# File 'lib/uniword/line_numbering.rb', line 29 def count_by @count_by end |
#distance ⇒ Integer
Distance from text in twips
29 30 31 |
# File 'lib/uniword/line_numbering.rb', line 29 def distance @distance end |
#restart ⇒ String
When to restart numbering
29 30 31 |
# File 'lib/uniword/line_numbering.rb', line 29 def restart @restart end |
#start ⇒ Integer
Starting line number
29 30 31 |
# File 'lib/uniword/line_numbering.rb', line 29 def start @start end |
Class Method Details
.continuous(count_by: 1, distance: 360) ⇒ LineNumbering
Create continuous line numbering (never restarts)
50 51 52 53 54 55 56 57 |
# File 'lib/uniword/line_numbering.rb', line 50 def self.continuous(count_by: 1, distance: 360) new( start: 1, count_by: count_by, restart: "continuous", distance: distance, ) end |
.per_page(count_by: 1, distance: 360) ⇒ LineNumbering
Create line numbering that restarts on each page
64 65 66 67 68 69 70 71 |
# File 'lib/uniword/line_numbering.rb', line 64 def self.per_page(count_by: 1, distance: 360) new( start: 1, count_by: count_by, restart: "newPage", distance: distance, ) end |
.per_section(count_by: 1, distance: 360) ⇒ LineNumbering
Create line numbering that restarts on each section
78 79 80 81 82 83 84 85 |
# File 'lib/uniword/line_numbering.rb', line 78 def self.per_section(count_by: 1, distance: 360) new( start: 1, count_by: count_by, restart: "newSection", distance: distance, ) end |
Instance Method Details
#continuous? ⇒ Boolean
Check if numbering is continuous (never restarts)
90 91 92 |
# File 'lib/uniword/line_numbering.rb', line 90 def continuous? restart == "continuous" end |
#per_page? ⇒ Boolean
Check if numbering restarts on each page
97 98 99 |
# File 'lib/uniword/line_numbering.rb', line 97 def per_page? restart == "newPage" end |
#per_section? ⇒ Boolean
Check if numbering restarts on each section
104 105 106 |
# File 'lib/uniword/line_numbering.rb', line 104 def per_section? restart == "newSection" end |