Class: Uniword::PageBorders
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Uniword::PageBorders
- Defined in:
- lib/uniword/page_borders.rb
Overview
Represents page borders for a section
Page borders can be applied to all sides of pages in a section.
Constant Summary collapse
- DISPLAY_OPTIONS =
Display options
%w[allPages firstPage notFirstPage].freeze
- OFFSET_OPTIONS =
Offset reference options
%w[page text].freeze
Instance Attribute Summary collapse
-
#bottom ⇒ PageBorderSide
Bottom border.
-
#display ⇒ String
When to display borders (allPages, firstPage, notFirstPage).
-
#left ⇒ PageBorderSide
Left border.
-
#offset_from ⇒ String
Measurement reference (page, text).
-
#right ⇒ PageBorderSide
Right border.
-
#top ⇒ PageBorderSide
Top border.
Class Method Summary collapse
-
.all_sides(style: "single", color: "auto", width: 6) ⇒ PageBorders
Create borders on all sides with same properties.
Instance Method Summary collapse
-
#any? ⇒ Boolean
Check if any border is defined.
-
#initialize(**attributes) ⇒ PageBorders
constructor
A new instance of PageBorders.
Constructor Details
#initialize(**attributes) ⇒ PageBorders
Returns a new instance of PageBorders.
70 71 72 73 74 |
# File 'lib/uniword/page_borders.rb', line 70 def initialize(**attributes) super validate_display validate_offset_from end |
Instance Attribute Details
#bottom ⇒ PageBorderSide
Bottom border
56 57 58 |
# File 'lib/uniword/page_borders.rb', line 56 def bottom @bottom end |
#display ⇒ String
When to display borders (allPages, firstPage, notFirstPage)
56 57 58 |
# File 'lib/uniword/page_borders.rb', line 56 def display @display end |
#left ⇒ PageBorderSide
Left border
56 57 58 |
# File 'lib/uniword/page_borders.rb', line 56 def left @left end |
#offset_from ⇒ String
Measurement reference (page, text)
56 57 58 |
# File 'lib/uniword/page_borders.rb', line 56 def offset_from @offset_from end |
#right ⇒ PageBorderSide
Right border
56 57 58 |
# File 'lib/uniword/page_borders.rb', line 56 def right @right end |
#top ⇒ PageBorderSide
Top border
56 57 58 |
# File 'lib/uniword/page_borders.rb', line 56 def top @top end |
Class Method Details
.all_sides(style: "single", color: "auto", width: 6) ⇒ PageBorders
Create borders on all sides with same properties
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/uniword/page_borders.rb', line 83 def self.all_sides(style: "single", color: "auto", width: 6, **) border_side = PageBorderSide.new(style: style, color: color, width: width) new( top: border_side, bottom: border_side, left: border_side, right: border_side, ** ) end |
Instance Method Details
#any? ⇒ Boolean
Check if any border is defined
97 98 99 |
# File 'lib/uniword/page_borders.rb', line 97 def any? !top.nil? || !bottom.nil? || !left.nil? || !right.nil? end |