Sha256: 7d3ee62b068b47adfa8450bd537d0d810bce88f275a4c72b2c056a38c15cc5d5
Contents?: true
Size: 810 Bytes
Versions: 3
Compression:
Stored size: 810 Bytes
Contents
# encoding: utf-8 module Adhearsion 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::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::RAYO_NAMESPACES[:core] end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
adhearsion-3.0.0.rc1 | lib/adhearsion/has_headers.rb |
adhearsion-3.0.0.beta2 | lib/adhearsion/has_headers.rb |
adhearsion-3.0.0.beta1 | lib/adhearsion/has_headers.rb |