module Punchblock::HasHeaders
Public Class Methods
included(klass)
click to toggle source
# File lib/punchblock/has_headers.rb, line 5 def self.included(klass) klass.attribute :headers, Hash, default: {} end
Public Instance Methods
headers=(other)
click to toggle source
Calls superclass method
# File lib/punchblock/has_headers.rb, line 9 def headers=(other) super(other || {}) end
inherit(xml_node)
click to toggle source
Calls superclass method
# File lib/punchblock/has_headers.rb, line 13 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
rayo_children(root)
click to toggle source
Calls superclass method
# File lib/punchblock/has_headers.rb, line 25 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