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.
124 125 126 127 128 |
# File 'lib/hexapdf/layout/text_layouter.rb', line 124 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.
115 116 117 |
# File 'lib/hexapdf/layout/text_layouter.rb', line 115 def item @item end |
#shrinkability ⇒ Object (readonly)
The amount by which the glue could be shrunk.
121 122 123 |
# File 'lib/hexapdf/layout/text_layouter.rb', line 121 def shrinkability @shrinkability end |
#stretchability ⇒ Object (readonly)
The amount by which the glue could be stretched.
118 119 120 |
# File 'lib/hexapdf/layout/text_layouter.rb', line 118 def stretchability @stretchability end |
Instance Method Details
#inspect ⇒ Object
:nodoc:
140 141 142 |
# File 'lib/hexapdf/layout/text_layouter.rb', line 140 def inspect #:nodoc: "Glue[#{@item.inspect}]" end |
#type ⇒ Object
Returns :glue.
136 137 138 |
# File 'lib/hexapdf/layout/text_layouter.rb', line 136 def type :glue end |
#width ⇒ Object
The width of the item.
131 132 133 |
# File 'lib/hexapdf/layout/text_layouter.rb', line 131 def width @item.width end |