Class: Uniword::Wordprocessingml::ParagraphBorders

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/uniword/wordprocessingml/paragraph_borders.rb

Overview

Paragraph borders

Generated from OOXML schema: wordprocessingml.yml Element: <w:pBdr>

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.box(style:, color:, size: 6, space: 1) ⇒ ParagraphBorders

Create a box-style border (all four sides with same style)

Parameters:

  • style (String)

    Border style

  • color (String)

    Border color (hex)

  • size (Integer) (defaults to: 6)

    Border size

  • space (Integer) (defaults to: 1)

    Border space

Returns:



39
40
41
42
# File 'lib/uniword/wordprocessingml/paragraph_borders.rb', line 39

def self.box(style:, color:, size: 6, space: 1)
  border = Border.new(val: style, color: color, sz: size, space: space)
  new(top: border, bottom: border, left: border, right: border)
end

Instance Method Details

#box?Boolean

Check if this is a box-style border (all four sides present with same style)

Returns:

  • (Boolean)

    true if box-style



47
48
49
50
51
52
53
# File 'lib/uniword/wordprocessingml/paragraph_borders.rb', line 47

def box?
  return false unless top && bottom && left && right
  return false unless top.val == bottom.val && top.val == left.val && top.val == right.val
  return false unless top.color == bottom.color && top.color == left.color && top.color == right.color

  true
end