Class: Mindee::Parsing::Standard::AmountField

Inherits:
Field show all
Defined in:
lib/mindee/parsing/standard/amount_field.rb

Overview

Represents tax information.

Instance Attribute Summary collapse

Attributes inherited from Field

#reconstructed

Attributes inherited from AbstractField

#bounding_box, #confidence, #page_id, #polygon

Instance Method Summary collapse

Methods inherited from AbstractField

array_confidence, array_sum, float_to_string

Constructor Details

#initialize(prediction, page_id, reconstructed: false) ⇒ AmountField

Returns a new instance of AmountField.



14
15
16
17
# File 'lib/mindee/parsing/standard/amount_field.rb', line 14

def initialize(prediction, page_id, reconstructed: false)
  super
  @value = @value.round(3) unless @value.nil?
end

Instance Attribute Details

#valueFloat? (readonly)

Amount value as 3 decimal float

Returns:

  • (Float, nil)


12
13
14
# File 'lib/mindee/parsing/standard/amount_field.rb', line 12

def value
  @value
end

Instance Method Details

#to_sString

Returns:

  • (String)


20
21
22
# File 'lib/mindee/parsing/standard/amount_field.rb', line 20

def to_s
  Field.float_to_string(@value)
end