Class: HexaPDF::Layout::TextBox::Glue

Inherits:
Object
  • Object
show all
Defined in:
lib/hexapdf/layout/text_box.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

Instance Method Summary collapse

Constructor Details

#initialize(item, stretchability = item.width / 2, shrinkability = item.width / 3) ⇒ Glue

Creates a new Glue for the item.



105
106
107
108
109
# File 'lib/hexapdf/layout/text_box.rb', line 105

def initialize(item, stretchability = item.width / 2, shrinkability = item.width / 3)
  @item = item
  @stretchability = stretchability
  @shrinkability = shrinkability
end

Instance Attribute Details

#itemObject (readonly)

The wrapped item.



96
97
98
# File 'lib/hexapdf/layout/text_box.rb', line 96

def item
  @item
end

#shrinkabilityObject (readonly)

The amount by which the glue could be shrunk.



102
103
104
# File 'lib/hexapdf/layout/text_box.rb', line 102

def shrinkability
  @shrinkability
end

#stretchabilityObject (readonly)

The amount by which the glue could be stretched.



99
100
101
# File 'lib/hexapdf/layout/text_box.rb', line 99

def stretchability
  @stretchability
end

Instance Method Details

#typeObject

Returns :glue.



112
113
114
# File 'lib/hexapdf/layout/text_box.rb', line 112

def type
  :glue
end