Sha256: e01c91b84f384d7df018baf1e820470393d976a530d2a8d3d5065342e4848b47
Contents?: true
Size: 757 Bytes
Versions: 3
Compression:
Stored size: 757 Bytes
Contents
module Wukong class Processor # Joins XML input data based on a root tag. class JoinXML < Processor field :root, String, default: 'xml', doc: "Name of the root XML element" def setup @lines = [] end def process line if match = terminator.match(line) if match.end(0) == line.size @lines << line else @lines << line[0...match.end(0)] end yield @lines.join("\n") @lines = [] @lines << line[match.end(0)..-1] unless match.end(0) == line.size else @lines << line end end def terminator %r{<\s*/\s*#{root}\s*>}i end register :join_xml end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
ul-wukong-4.1.1 | lib/wukong/widget/reducers/join_xml.rb |
ul-wukong-4.1.0 | lib/wukong/widget/reducers/join_xml.rb |
wukong-4.0.0 | lib/wukong/widget/reducers/join_xml.rb |