Class: Mindee::V2::Product::Crop::CropResult

Inherits:
Object
  • Object
show all
Defined in:
lib/mindee/v2/product/crop/crop_result.rb

Overview

Result of a crop utility inference.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(server_response) ⇒ CropResult

Returns a new instance of CropResult.

Parameters:

  • server_response (Hash)

    Hash representation of the JSON returned by the service.



15
16
17
18
19
20
21
# File 'lib/mindee/v2/product/crop/crop_result.rb', line 15

def initialize(server_response)
  @crops = if server_response.key?('crops')
             server_response['crops'].map do |crop|
               CropItem.new(crop)
             end
           end
end

Instance Attribute Details

#cropsArray<Cropitem> (readonly)

Returns List of results of cropped document regions.

Returns:

  • (Array<Cropitem>)

    List of results of cropped document regions.



12
13
14
# File 'lib/mindee/v2/product/crop/crop_result.rb', line 12

def crops
  @crops
end

Instance Method Details

#to_sString

String representation.

Returns:

  • (String)


25
26
27
28
29
# File 'lib/mindee/v2/product/crop/crop_result.rb', line 25

def to_s
  crops_str = @crops.join("\n")

  "Crops\n=====\n#{crops_str}"
end