Class: Mindee::Parsing::Common::Extras::CropperExtra

Inherits:
Object
  • Object
show all
Defined in:
lib/mindee/parsing/common/extras/cropper_extra.rb

Overview

Contains information on the cropping of a prediction.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_prediction, page_id = nil) ⇒ CropperExtra

Returns a new instance of CropperExtra.



15
16
17
18
19
20
# File 'lib/mindee/parsing/common/extras/cropper_extra.rb', line 15

def initialize(raw_prediction, page_id = nil)
  @croppings = []
  raw_prediction['cropping']&.each do |crop|
    @croppings.push(Mindee::Parsing::Standard::PositionField.new(crop, page_id))
  end
end

Instance Attribute Details

#croppingsArray<Mindee::Parsing::Standard::PositionField> (readonly)

Cropper extra initialization.



13
14
15
# File 'lib/mindee/parsing/common/extras/cropper_extra.rb', line 13

def croppings
  @croppings
end

Instance Method Details

#to_sObject



22
23
24
# File 'lib/mindee/parsing/common/extras/cropper_extra.rb', line 22

def to_s
  @croppings.map(&:to_s).join("\n           ")
end