class AmazonTRP::FieldValue

Attributes

block[R]
confidence[R]
content[R]
geometry[R]
id[R]
text[R]

Public Class Methods

new(block, children, blockMap) click to toggle source
# File lib/amazon-textract-parser-ruby.rb, line 190
def initialize(block, children, blockMap)
  @block = block
  @confidence = block[:confidence]
  @geometry = Geometry.new(block[:geometry])
  @id = block[:id]
  @text = ""
  @content = []
  
  t = []
  children.each do |eid|
    wb = blockMap[eid]
    if wb[:block_type] == "WORD"
      w = Word.new(wb, blockMap)
      @content.append(w)
      t.append(w.text)
    elsif wb[:block_type] == "SELECTION_ELEMENT"
      se = SelectionElement.new(wb, blockMap)
      @content.append(se)
      t.append(se.selectionStatus)
    end
  end
  
  @text = t.join(' ') if t
end

Public Instance Methods

to_s() click to toggle source
# File lib/amazon-textract-parser-ruby.rb, line 215
def to_s
  @text
end