Class: AmazonTRP::Cell
- Inherits:
-
Object
- Object
- AmazonTRP::Cell
- Defined in:
- lib/amazon-textract-parser-ruby.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#columnIndex ⇒ Object
readonly
Returns the value of attribute columnIndex.
-
#columnSpan ⇒ Object
readonly
Returns the value of attribute columnSpan.
-
#confidence ⇒ Object
readonly
Returns the value of attribute confidence.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#geometry ⇒ Object
readonly
Returns the value of attribute geometry.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#rowIndex ⇒ Object
readonly
Returns the value of attribute rowIndex.
-
#rowSpan ⇒ Object
readonly
Returns the value of attribute rowSpan.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(block, blockMap) ⇒ Cell
constructor
A new instance of Cell.
- #to_s ⇒ Object
Constructor Details
#initialize(block, blockMap) ⇒ Cell
Returns a new instance of Cell.
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
# File 'lib/amazon-textract-parser-ruby.rb', line 323 def initialize(block, blockMap) @block = block @confidence = block[:confidence] @rowIndex = block[:row_index] @columnIndex = block[:column_index] @rowSpan = block[:row_span] @columnSpan = block[:column_span] @geometry = Geometry.new(block[:geometry]) @id = block[:id] @content = [] @text = "" if block[:relationships] block[:relationships].each do |rs| if rs[:type] == 'CHILD' for cid in rs[:ids] blockType = blockMap[cid][:block_type] if blockType == "WORD" w = Word.new(blockMap[cid], blockMap) @content.append(w) @text = @text + w.text + ' ' elsif blockType == "SELECTION_ELEMENT" se = SelectionElement.new(blockMap[cid], blockMap) @content.append(se) @text = @text + se.selectionStatus + ', ' end end end end end @text = @text.strip end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
321 322 323 |
# File 'lib/amazon-textract-parser-ruby.rb', line 321 def block @block end |
#columnIndex ⇒ Object (readonly)
Returns the value of attribute columnIndex.
314 315 316 |
# File 'lib/amazon-textract-parser-ruby.rb', line 314 def columnIndex @columnIndex end |
#columnSpan ⇒ Object (readonly)
Returns the value of attribute columnSpan.
316 317 318 |
# File 'lib/amazon-textract-parser-ruby.rb', line 316 def columnSpan @columnSpan end |
#confidence ⇒ Object (readonly)
Returns the value of attribute confidence.
312 313 314 |
# File 'lib/amazon-textract-parser-ruby.rb', line 312 def confidence @confidence end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
319 320 321 |
# File 'lib/amazon-textract-parser-ruby.rb', line 319 def content @content end |
#geometry ⇒ Object (readonly)
Returns the value of attribute geometry.
317 318 319 |
# File 'lib/amazon-textract-parser-ruby.rb', line 317 def geometry @geometry end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
318 319 320 |
# File 'lib/amazon-textract-parser-ruby.rb', line 318 def id @id end |
#rowIndex ⇒ Object (readonly)
Returns the value of attribute rowIndex.
313 314 315 |
# File 'lib/amazon-textract-parser-ruby.rb', line 313 def rowIndex @rowIndex end |
#rowSpan ⇒ Object (readonly)
Returns the value of attribute rowSpan.
315 316 317 |
# File 'lib/amazon-textract-parser-ruby.rb', line 315 def rowSpan @rowSpan end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
320 321 322 |
# File 'lib/amazon-textract-parser-ruby.rb', line 320 def text @text end |
Instance Method Details
#to_s ⇒ Object
355 356 357 |
# File 'lib/amazon-textract-parser-ruby.rb', line 355 def to_s @text end |