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



40
41
42
# File 'lib/soap/header/handlerset.rb', line 40

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

#get_handler(handler_class) ⇒ Object



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

def get_handler(handler_class)
  handler_trovato = @store.find { |handler_salvato|
    handler_salvato.elename == handler_class::QName
  }
  handler_trovato
end

#include?(handler) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#on_inbound(header) ⇒ Object

header: SOAPHeaderItem enumerable object



56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/soap/header/handlerset.rb', line 56

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



49
50
51
52
53
# File 'lib/soap/header/handlerset.rb', line 49

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