Class: SOAP::Header::HandlerSet

Inherits:
Object
  • Object
show all
Defined in:
lib/soap/header/handlerset.rb

Instance Method Summary collapse

Constructor Details

#initializeHandlerSet

Returns a new instance of HandlerSet.



17
18
19
# File 'lib/soap/header/handlerset.rb', line 17

def initialize
  @store = XSD::NamedElements.new
end

Instance Method Details

#add(handler) ⇒ Object Also known as: <<



27
28
29
# File 'lib/soap/header/handlerset.rb', line 27

def add(handler)
  @store << handler
end

#delete(handler) ⇒ Object



32
33
34
# File 'lib/soap/header/handlerset.rb', line 32

def delete(handler)
  @store.delete(handler)
end

#dupObject



21
22
23
24
25
# File 'lib/soap/header/handlerset.rb', line 21

def dup
  obj = HandlerSet.new
  obj.store = @store.dup
  obj
end

#include?(handler) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/soap/header/handlerset.rb', line 36

def include?(handler)
  @store.include?(handler)
end

#on_inbound(headers) ⇒ Object

headers: SOAPHeaderItem enumerable object



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/soap/header/handlerset.rb', line 48

def on_inbound(headers)
  headers.each do |name, item|
    handler = @store.find { |handler|
      handler.elename == item.element.elename
    }
    if handler
      handler.on_inbound_headeritem(item)
    elsif item.mustunderstand
      raise UnhandledMustUnderstandHeaderError.new(item.element.elename.to_s)
    end
  end
end

#on_outboundObject

returns: Array of SOAPHeaderItem



41
42
43
44
45
# File 'lib/soap/header/handlerset.rb', line 41

def on_outbound
  @store.collect { |handler|
    handler.on_outbound_headeritem
  }.compact
end