Module: Moxml::Materializer::Record
- Defined in:
- lib/moxml/materializer.rb
Overview
Builds the Hash snapshot form from the field stream — the one place the eight-key record shape is materialized.
Class Method Summary collapse
- .from_fields(kind, qname, prefix, namespace_uri, namespaces, attributes, text, depth) ⇒ Object
- .group_flat(flat, stride) ⇒ Object
Class Method Details
.from_fields(kind, qname, prefix, namespace_uri, namespaces, attributes, text, depth) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/moxml/materializer.rb', line 58 def from_fields(kind, qname, prefix, namespace_uri, namespaces, attributes, text, depth) { kind: kind, qname: qname, prefix: prefix, namespace_uri: namespace_uri, namespaces: group_flat(namespaces, 2), attributes: group_flat(attributes, 4), text: text, depth: depth, } end |
.group_flat(flat, stride) ⇒ Object
72 73 74 75 76 |
# File 'lib/moxml/materializer.rb', line 72 def group_flat(flat, stride) return EMPTY_ATTRIBUTES if flat.empty? flat.each_slice(stride).to_a end |