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.



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

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

Instance Method Details

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



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

def add(handler)
  @store << handler
end

#delete(handler) ⇒ Object



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

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

#dupObject



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

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

#include?(handler) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#on_inbound(header) ⇒ Object

header: SOAPHeaderItem enumerable object



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

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

#on_outbound(header) ⇒ Object

returns: Array of SOAPHeaderItem



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

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