Class: Uniword::TabStop
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Uniword::TabStop
- Defined in:
- lib/uniword/tab_stop.rb
Overview
Represents a tab stop in a paragraph
Tab stops control where the cursor moves when the Tab key is pressed. They can have different alignments and leader characters.
Constant Summary collapse
- ALIGNMENTS =
Alignment options
%w[left center right decimal bar num].freeze
- LEADERS =
Leader options
%w[none dot hyphen underscore heavy middleDot].freeze
Instance Attribute Summary collapse
-
#alignment ⇒ String
Alignment type (left, center, right, decimal, bar).
-
#leader ⇒ String
Leader character (none, dot, hyphen, underscore, heavy).
-
#position ⇒ Integer
Position in twips from left margin.
Class Method Summary collapse
-
.center(position, leader: "none") ⇒ TabStop
Create a center-aligned tab stop.
-
.decimal(position, leader: "none") ⇒ TabStop
Create a decimal-aligned tab stop (for numbers).
-
.left(position, leader: "none") ⇒ TabStop
Create a left-aligned tab stop.
-
.right(position, leader: "none") ⇒ TabStop
Create a right-aligned tab stop.
Instance Method Summary collapse
-
#initialize(**attributes) ⇒ TabStop
constructor
A new instance of TabStop.
Constructor Details
#initialize(**attributes) ⇒ TabStop
Returns a new instance of TabStop.
28 29 30 31 32 |
# File 'lib/uniword/tab_stop.rb', line 28 def initialize(**attributes) super validate_alignment validate_leader end |
Instance Attribute Details
#alignment ⇒ String
Alignment type (left, center, right, decimal, bar)
17 18 19 |
# File 'lib/uniword/tab_stop.rb', line 17 def alignment @alignment end |
#leader ⇒ String
Leader character (none, dot, hyphen, underscore, heavy)
17 18 19 |
# File 'lib/uniword/tab_stop.rb', line 17 def leader @leader end |
#position ⇒ Integer
Position in twips from left margin
17 18 19 |
# File 'lib/uniword/tab_stop.rb', line 17 def position @position end |
Class Method Details
.center(position, leader: "none") ⇒ TabStop
Create a center-aligned tab stop
48 49 50 |
# File 'lib/uniword/tab_stop.rb', line 48 def self.center(position, leader: "none") new(position: position, alignment: "center", leader: leader) end |
.decimal(position, leader: "none") ⇒ TabStop
Create a decimal-aligned tab stop (for numbers)
66 67 68 |
# File 'lib/uniword/tab_stop.rb', line 66 def self.decimal(position, leader: "none") new(position: position, alignment: "decimal", leader: leader) end |
.left(position, leader: "none") ⇒ TabStop
Create a left-aligned tab stop
39 40 41 |
# File 'lib/uniword/tab_stop.rb', line 39 def self.left(position, leader: "none") new(position: position, alignment: "left", leader: leader) end |
.right(position, leader: "none") ⇒ TabStop
Create a right-aligned tab stop
57 58 59 |
# File 'lib/uniword/tab_stop.rb', line 57 def self.right(position, leader: "none") new(position: position, alignment: "right", leader: leader) end |