Class: Kreuzberg::Result::OcrBoundingGeometry

Inherits:
Object
  • Object
show all
Defined in:
lib/kreuzberg/result.rb

Overview

OCR bounding geometry with type and coordinates

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, left: nil, top: nil, width: nil, height: nil, points: nil) ⇒ OcrBoundingGeometry

Returns a new instance of OcrBoundingGeometry.



246
247
248
249
250
251
252
253
# File 'lib/kreuzberg/result.rb', line 246

def initialize(type:, left: nil, top: nil, width: nil, height: nil, points: nil)
  @type = type.to_s
  @left = left&.to_f
  @top = top&.to_f
  @width = width&.to_f
  @height = height&.to_f
  @points = points
end

Instance Attribute Details

#heightObject (readonly)

Returns the value of attribute height.



244
245
246
# File 'lib/kreuzberg/result.rb', line 244

def height
  @height
end

#leftObject (readonly)

Returns the value of attribute left.



244
245
246
# File 'lib/kreuzberg/result.rb', line 244

def left
  @left
end

#pointsObject (readonly)

Returns the value of attribute points.



244
245
246
# File 'lib/kreuzberg/result.rb', line 244

def points
  @points
end

#topObject (readonly)

Returns the value of attribute top.



244
245
246
# File 'lib/kreuzberg/result.rb', line 244

def top
  @top
end

#typeObject (readonly)

Returns the value of attribute type.



244
245
246
# File 'lib/kreuzberg/result.rb', line 244

def type
  @type
end

#widthObject (readonly)

Returns the value of attribute width.



244
245
246
# File 'lib/kreuzberg/result.rb', line 244

def width
  @width
end

Instance Method Details

#to_hObject



255
256
257
258
259
260
261
262
263
264
# File 'lib/kreuzberg/result.rb', line 255

def to_h
  {
    type: @type,
    left: @left,
    top: @top,
    width: @width,
    height: @height,
    points: @points
  }.compact
end