Class: AmazonTRP::Field
- Inherits:
-
Object
- Object
- AmazonTRP::Field
- Defined in:
- lib/amazon-textract-parser-ruby.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(block, blockMap) ⇒ Field
constructor
A new instance of Field.
- #to_s ⇒ Object
Constructor Details
#initialize(block, blockMap) ⇒ Field
Returns a new instance of Field.
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/amazon-textract-parser-ruby.rb', line 225 def initialize(block, blockMap) @key = nil @value = nil block[:relationships].each do |item| if item[:type] == "CHILD" @key = FieldKey.new(block, item[:ids], blockMap) elsif item[:type] == "VALUE" item[:ids].each do |eid| vkvs = blockMap[eid] if vkvs[:entity_types].include?('VALUE') if vkvs.has_key?(:relationships) vkvs[:relationships].each do |vitem| @value = FieldValue.new(vkvs, vitem[:ids], blockMap) if vitem[:type] == "CHILD" end end end end end end end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
222 223 224 |
# File 'lib/amazon-textract-parser-ruby.rb', line 222 def key @key end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
223 224 225 |
# File 'lib/amazon-textract-parser-ruby.rb', line 223 def value @value end |
Instance Method Details
#to_s ⇒ Object
247 248 249 250 251 252 253 254 255 |
# File 'lib/amazon-textract-parser-ruby.rb', line 247 def to_s k = "" v = "" k = @key.to_s if @key v = @value.to_s if @value return "Field: #{k} = #{v}" end |