Class: Arrolio::TextLayout::KnuthPlass::Glue
- Defined in:
- lib/arrolio/text_layout/knuth_plass/item.rb
Overview
Glue represents inter-word space. Has a natural width plus stretchability (how much it can grow) and shrinkability (how much it can shrink). At a break point, trailing glue is discarded (doesn't contribute to line width).
Instance Attribute Summary collapse
-
#char_offset ⇒ Object
readonly
Returns the value of attribute char_offset.
-
#run_index ⇒ Object
readonly
Returns the value of attribute run_index.
-
#shrink ⇒ Object
readonly
Returns the value of attribute shrink.
-
#stretch ⇒ Object
readonly
Returns the value of attribute stretch.
Attributes inherited from Item
Instance Method Summary collapse
- #glue? ⇒ Boolean
-
#initialize(width:, stretch:, shrink:, run_index: nil, char_offset: nil) ⇒ Glue
constructor
A new instance of Glue.
Methods inherited from Item
Constructor Details
#initialize(width:, stretch:, shrink:, run_index: nil, char_offset: nil) ⇒ Glue
Returns a new instance of Glue.
43 44 45 46 47 48 49 |
# File 'lib/arrolio/text_layout/knuth_plass/item.rb', line 43 def initialize(width:, stretch:, shrink:, run_index: nil, char_offset: nil) super(width: width) @stretch = stretch.to_f @shrink = shrink.to_f @run_index = run_index @char_offset = char_offset end |
Instance Attribute Details
#char_offset ⇒ Object (readonly)
Returns the value of attribute char_offset.
41 42 43 |
# File 'lib/arrolio/text_layout/knuth_plass/item.rb', line 41 def char_offset @char_offset end |
#run_index ⇒ Object (readonly)
Returns the value of attribute run_index.
41 42 43 |
# File 'lib/arrolio/text_layout/knuth_plass/item.rb', line 41 def run_index @run_index end |
#shrink ⇒ Object (readonly)
Returns the value of attribute shrink.
41 42 43 |
# File 'lib/arrolio/text_layout/knuth_plass/item.rb', line 41 def shrink @shrink end |
#stretch ⇒ Object (readonly)
Returns the value of attribute stretch.
41 42 43 |
# File 'lib/arrolio/text_layout/knuth_plass/item.rb', line 41 def stretch @stretch end |
Instance Method Details
#glue? ⇒ Boolean
51 |
# File 'lib/arrolio/text_layout/knuth_plass/item.rb', line 51 def glue? = true |