Class: HexaPDF::Layout::TextLayouter::Glue
- Inherits:
-
Object
- Object
- HexaPDF::Layout::TextLayouter::Glue
- Defined in:
- lib/hexapdf/layout/text_layouter.rb
Overview
Used for layouting. Describes a glue item, i.e. an item describing white space that could potentially be shrunk or stretched.
Instance Attribute Summary collapse
-
#item ⇒ Object
readonly
The wrapped item.
-
#shrinkability ⇒ Object
readonly
The amount by which the glue could be shrunk.
-
#stretchability ⇒ Object
readonly
The amount by which the glue could be stretched.
Instance Method Summary collapse
-
#initialize(item, stretchability = item.width / 2, shrinkability = item.width / 3) ⇒ Glue
constructor
Creates a new Glue for the item.
-
#inspect ⇒ Object
:nodoc:.
-
#type ⇒ Object
Returns :glue.
-
#width ⇒ Object
The width of the item.
Constructor Details
#initialize(item, stretchability = item.width / 2, shrinkability = item.width / 3) ⇒ Glue
Creates a new Glue for the item.
123 124 125 126 127 |
# File 'lib/hexapdf/layout/text_layouter.rb', line 123 def initialize(item, stretchability = item.width / 2, shrinkability = item.width / 3) @item = item @stretchability = stretchability @shrinkability = shrinkability end |
Instance Attribute Details
#item ⇒ Object (readonly)
The wrapped item.
114 115 116 |
# File 'lib/hexapdf/layout/text_layouter.rb', line 114 def item @item end |
#shrinkability ⇒ Object (readonly)
The amount by which the glue could be shrunk.
120 121 122 |
# File 'lib/hexapdf/layout/text_layouter.rb', line 120 def shrinkability @shrinkability end |
#stretchability ⇒ Object (readonly)
The amount by which the glue could be stretched.
117 118 119 |
# File 'lib/hexapdf/layout/text_layouter.rb', line 117 def stretchability @stretchability end |
Instance Method Details
#inspect ⇒ Object
:nodoc:
139 140 141 |
# File 'lib/hexapdf/layout/text_layouter.rb', line 139 def inspect #:nodoc: "Glue[#{@item.inspect}]" end |
#type ⇒ Object
Returns :glue.
135 136 137 |
# File 'lib/hexapdf/layout/text_layouter.rb', line 135 def type :glue end |
#width ⇒ Object
The width of the item.
130 131 132 |
# File 'lib/hexapdf/layout/text_layouter.rb', line 130 def width @item.width end |