Class: Kreuzberg::Result::DocumentBoundingBox
- Inherits:
-
Object
- Object
- Kreuzberg::Result::DocumentBoundingBox
- Defined in:
- lib/kreuzberg/document_structure.rb
Overview
Bounding box for document node positioning.
Represents rectangular coordinates for a node within the document.
Instance Attribute Summary collapse
-
#x0 ⇒ Object
readonly
Returns the value of attribute x0.
-
#x1 ⇒ Object
readonly
Returns the value of attribute x1.
-
#y0 ⇒ Object
readonly
Returns the value of attribute y0.
-
#y1 ⇒ Object
readonly
Returns the value of attribute y1.
Instance Method Summary collapse
-
#initialize(hash) ⇒ DocumentBoundingBox
constructor
A new instance of DocumentBoundingBox.
-
#to_h ⇒ Hash
Convert to hash.
Constructor Details
#initialize(hash) ⇒ DocumentBoundingBox
Returns a new instance of DocumentBoundingBox.
131 132 133 134 135 136 |
# File 'lib/kreuzberg/document_structure.rb', line 131 def initialize(hash) @x0 = extract_float(hash, 'x0') @y0 = extract_float(hash, 'y0') @x1 = extract_float(hash, 'x1') @y1 = extract_float(hash, 'y1') end |
Instance Attribute Details
#x0 ⇒ Object (readonly)
Returns the value of attribute x0.
129 130 131 |
# File 'lib/kreuzberg/document_structure.rb', line 129 def x0 @x0 end |
#x1 ⇒ Object (readonly)
Returns the value of attribute x1.
129 130 131 |
# File 'lib/kreuzberg/document_structure.rb', line 129 def x1 @x1 end |
#y0 ⇒ Object (readonly)
Returns the value of attribute y0.
129 130 131 |
# File 'lib/kreuzberg/document_structure.rb', line 129 def y0 @y0 end |
#y1 ⇒ Object (readonly)
Returns the value of attribute y1.
129 130 131 |
# File 'lib/kreuzberg/document_structure.rb', line 129 def y1 @y1 end |
Instance Method Details
#to_h ⇒ Hash
Convert to hash
142 143 144 145 146 147 148 149 |
# File 'lib/kreuzberg/document_structure.rb', line 142 def to_h { x0: @x0, y0: @y0, x1: @x1, y1: @y1 }.compact end |