| Class | Ariel::Node::Extracted |
| In: |
lib/ariel/node/extracted.rb
|
| Parent: | Node |
Each Node::Extracted has a name, a TokenStream and a structure which points to the relevant Node::Structure. Skip straight to search, #/ and at for the query interface. This is strongly recommended over using the built in method accessors (a method isn’t defined if a given field isn’t extracted, so you’re going to have to catch a lot of potential errors).
| structure_node | [RW] | |
| tokenstream | [RW] |
Index based accessor for the Node::Extracted’s children. Supports Range objects. Aims to provide behaviour that makes sense, especially when a Node has list children. Node::Extracted# will return an array, while Node::Extracted[0] will not. This behaviour is the same as Ruby’s standard Array class.
Acts exactly like search, but returns only the first match or nil if there are no matches.
The preferred way of querying extracted information. If nothing was extracted, an empty array is returned. This is much safer than using Node::Extracted accessors. Consider if your code is reading doc.address.phone_number.area_code - this will raise an error if any one of these were not extracted. (doc/’address/phone_number/area_code’) is preferred. Numbered list_items can be queried e.g. (doc/’comment_list/2’), and basic globbing is supported: (doc/’*/*/title’).