Sha256: 0dc27d49c7b812cb4b06a21c0a7e3b7f7379778ac1267ae0f0e30bdaffe54d09
Contents?: true
Size: 798 Bytes
Versions: 6
Compression:
Stored size: 798 Bytes
Contents
# encoding: utf-8 module Punchblock module HasHeaders def self.included(klass) klass.attribute :headers, Hash, default: {} end def headers=(other) super(other || {}) end def inherit(xml_node) xml_node.xpath('//ns:header', ns: RAYO_NAMESPACES[:core]).to_a.each do |header| if headers.has_key?(header[:name]) headers[header[:name]] = [headers[header[:name]]] headers[header[:name]] << header[:value] else headers[header[:name]] = header[:value] end end super end def rayo_children(root) super headers.each do |name, value| Array(value).each do |v| root.header name: name, value: v, xmlns: RAYO_NAMESPACES[:core] end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems