Class: LolSoap::WSDL::Type

Inherits:
Object
  • Object
show all
Defined in:
lib/lolsoap/wsdl/type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, prefix, elements, attributes) ⇒ Type

Returns a new instance of Type.



7
8
9
10
11
12
# File 'lib/lolsoap/wsdl/type.rb', line 7

def initialize(name, prefix, elements, attributes)
  @name       = name
  @prefix     = prefix
  @elements   = elements
  @attributes = Set.new(attributes)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/lolsoap/wsdl/type.rb', line 5

def name
  @name
end

#prefixObject (readonly)

Returns the value of attribute prefix.



5
6
7
# File 'lib/lolsoap/wsdl/type.rb', line 5

def prefix
  @prefix
end

Instance Method Details

#attributesObject



30
31
32
# File 'lib/lolsoap/wsdl/type.rb', line 30

def attributes
  @attributes.to_a
end

#element(name) ⇒ Object



18
19
20
# File 'lib/lolsoap/wsdl/type.rb', line 18

def element(name)
  @elements.fetch(name) { NullElement.new }
end

#element_prefix(name) ⇒ Object



22
23
24
# File 'lib/lolsoap/wsdl/type.rb', line 22

def element_prefix(name)
  @elements.fetch(name, self).prefix
end

#elementsObject



14
15
16
# File 'lib/lolsoap/wsdl/type.rb', line 14

def elements
  @elements.dup
end

#has_attribute?(name) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/lolsoap/wsdl/type.rb', line 34

def has_attribute?(name)
  @attributes.include?(name)
end

#inspectObject



38
39
40
41
42
# File 'lib/lolsoap/wsdl/type.rb', line 38

def inspect
  "<#{self.class} name=\"#{prefix_and_name}\" " \
    "elements=#{elements.inspect} " \
    "attributes=#{attributes.inspect}>"
end

#prefix_and_nameObject



44
45
46
# File 'lib/lolsoap/wsdl/type.rb', line 44

def prefix_and_name
  "#{prefix}:#{name}"
end

#sub_type(name) ⇒ Object



26
27
28
# File 'lib/lolsoap/wsdl/type.rb', line 26

def sub_type(name)
  element(name).type
end