~ubuntu-branches/ubuntu/trusty/ruby1.9/trusty

« back to all changes in this revision

Viewing changes to lib/soap/header/handler.rb

  • Committer: Bazaar Package Importer
  • Author(s): Stephan Hermann
  • Date: 2008-01-24 11:42:29 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20080124114229-jw2f87rdxlq6gp11
Tags: 1.9.0.0-2ubuntu1
* Merge from debian unstable, remaining changes:
  - Robustify check for target_os, fixing build failure on lpia.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# SOAP4R - SOAP Header handler item
2
 
# Copyright (C) 2003, 2003  NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
3
 
 
4
 
# This program is copyrighted free software by NAKAMURA, Hiroshi.  You can
5
 
# redistribute it and/or modify it under the same terms of Ruby's license;
6
 
# either the dual license version in 2003, or any later version.
7
 
 
8
 
 
9
 
require 'soap/element'
10
 
 
11
 
 
12
 
module SOAP
13
 
module Header
14
 
 
15
 
 
16
 
class Handler
17
 
  attr_reader :elename
18
 
  attr_reader :mustunderstand
19
 
  attr_reader :encodingstyle
20
 
 
21
 
  def initialize(elename)
22
 
    @elename = elename
23
 
    @mustunderstand = false
24
 
    @encodingstyle = nil
25
 
  end
26
 
 
27
 
  # Should return a SOAP/OM, a SOAPHeaderItem or nil.
28
 
  def on_outbound
29
 
    nil
30
 
  end
31
 
 
32
 
  # Given header is a SOAPHeaderItem or nil.
33
 
  def on_inbound(header, mustunderstand = false)
34
 
    # do something.
35
 
  end
36
 
 
37
 
  def on_outbound_headeritem
38
 
    item = on_outbound
39
 
    if item.nil?
40
 
      nil
41
 
    elsif item.is_a?(::SOAP::SOAPHeaderItem)
42
 
      item.elename = @elename
43
 
      item
44
 
    else
45
 
      item.elename = @elename
46
 
      ::SOAP::SOAPHeaderItem.new(item, @mustunderstand, @encodingstyle)
47
 
    end
48
 
  end
49
 
 
50
 
  def on_inbound_headeritem(header)
51
 
    on_inbound(header.element, header.mustunderstand)
52
 
  end
53
 
end
54
 
 
55
 
 
56
 
end
57
 
end