Class: Arrolio::TextLayout::KnuthPlass::Item
- Inherits:
-
Object
- Object
- Arrolio::TextLayout::KnuthPlass::Item
- Defined in:
- lib/arrolio/text_layout/knuth_plass/item.rb
Overview
Base class for items in the Knuth-Plass line-breaking model. Every item has a width. Box and Glue are "content"; Penalty is a potential break point.
Instance Attribute Summary collapse
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #box? ⇒ Boolean
- #glue? ⇒ Boolean
-
#initialize(width:) ⇒ Item
constructor
A new instance of Item.
- #penalty? ⇒ Boolean
Constructor Details
#initialize(width:) ⇒ Item
Returns a new instance of Item.
12 13 14 |
# File 'lib/arrolio/text_layout/knuth_plass/item.rb', line 12 def initialize(width:) @width = width.to_f end |
Instance Attribute Details
#width ⇒ Object (readonly)
Returns the value of attribute width.
10 11 12 |
# File 'lib/arrolio/text_layout/knuth_plass/item.rb', line 10 def width @width end |
Instance Method Details
#box? ⇒ Boolean
16 |
# File 'lib/arrolio/text_layout/knuth_plass/item.rb', line 16 def box? = false |
#glue? ⇒ Boolean
17 |
# File 'lib/arrolio/text_layout/knuth_plass/item.rb', line 17 def glue? = false |
#penalty? ⇒ Boolean
18 |
# File 'lib/arrolio/text_layout/knuth_plass/item.rb', line 18 def penalty? = false |