Class: WSDL::XMLSchema::Attribute

Inherits:
Info
  • Object
show all
Defined in:
lib/wsdl/xmlSchema/attribute.rb

Instance Attribute Summary collapse

Attributes inherited from Info

#id, #parent, #root

Instance Method Summary collapse

Methods inherited from Info

#inspect, #parse_epilogue

Constructor Details

#initializeAttribute

Returns a new instance of Attribute.



57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/wsdl/xmlSchema/attribute.rb', line 57

def initialize
  super
  @use = nil
  @form = nil
  @name = nil
  @type = nil
  @local_simpletype = nil
  @default = nil
  @fixed = nil
  @ref = nil
  @refelement = nil
  @arytype = nil
end

Instance Attribute Details

#arytypeObject

Returns the value of attribute arytype



55
56
57
# File 'lib/wsdl/xmlSchema/attribute.rb', line 55

def arytype
  @arytype
end

#default=(value) ⇒ Object (writeonly)

Sets the attribute default

Parameters:

  • value

    the value to set the attribute default to.



43
44
45
# File 'lib/wsdl/xmlSchema/attribute.rb', line 43

def default=(value)
  @default = value
end

#fixed=(value) ⇒ Object (writeonly)

Sets the attribute fixed

Parameters:

  • value

    the value to set the attribute fixed to.



44
45
46
# File 'lib/wsdl/xmlSchema/attribute.rb', line 44

def fixed=(value)
  @fixed = value
end

#form=(value) ⇒ Object (writeonly)

Sets the attribute form

Parameters:

  • value

    the value to set the attribute form to.



39
40
41
# File 'lib/wsdl/xmlSchema/attribute.rb', line 39

def form=(value)
  @form = value
end

#local_simpletype=(value) ⇒ Object (writeonly)

Sets the attribute local_simpletype

Parameters:

  • value

    the value to set the attribute local_simpletype to.



42
43
44
# File 'lib/wsdl/xmlSchema/attribute.rb', line 42

def local_simpletype=(value)
  @local_simpletype = value
end

#name=(value) ⇒ Object (writeonly)

Sets the attribute name

Parameters:

  • value

    the value to set the attribute name to.



40
41
42
# File 'lib/wsdl/xmlSchema/attribute.rb', line 40

def name=(value)
  @name = value
end

#refObject

Returns the value of attribute ref



54
55
56
# File 'lib/wsdl/xmlSchema/attribute.rb', line 54

def ref
  @ref
end

#type=(value) ⇒ Object (writeonly)

Sets the attribute type

Parameters:

  • value

    the value to set the attribute type to.



41
42
43
# File 'lib/wsdl/xmlSchema/attribute.rb', line 41

def type=(value)
  @type = value
end

#use=(value) ⇒ Object (writeonly)

Sets the attribute use

Parameters:

  • value

    the value to set the attribute use to.



38
39
40
# File 'lib/wsdl/xmlSchema/attribute.rb', line 38

def use=(value)
  @use = value
end

Instance Method Details

#attr_reader_ref(symbol) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/wsdl/xmlSchema/attribute.rb', line 19

def attr_reader_ref(symbol)
  name = symbol.to_s
  module_eval <<-EOS
    def #{name}
      @#{name} || (refelement ? refelement.#{name} : nil)
    end
  EOS
end

#parse_attr(attr, value) ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/wsdl/xmlSchema/attribute.rb', line 87

def parse_attr(attr, value)
  case attr
  when RefAttrName
    @ref = value
  when UseAttrName
    @use = value.source
  when FormAttrName
    @form = value.source
  when NameAttrName
    if directelement?
      @name = XSD::QName.new(targetnamespace, value.source)
    else
      @name = XSD::QName.new(nil, value.source)
    end
  when TypeAttrName
    @type = value
  when DefaultAttrName
    @default = value.source
  when FixedAttrName
    @fixed = value.source
  when ArrayTypeAttrName
    @arytype = if value.namespace.nil?
        XSD::QName.new(XSD::Namespace, value.source)
      else
        value
      end
  else
    nil
  end
end

#parse_element(element) ⇒ Object



79
80
81
82
83
84
85
# File 'lib/wsdl/xmlSchema/attribute.rb', line 79

def parse_element(element)
  case element
  when SimpleTypeName
    @local_simpletype = SimpleType.new
    @local_simpletype
  end
end

#refelementObject



71
72
73
# File 'lib/wsdl/xmlSchema/attribute.rb', line 71

def refelement
  @refelement ||= root.collect_attributes[@ref]
end

#targetnamespaceObject



75
76
77
# File 'lib/wsdl/xmlSchema/attribute.rb', line 75

def targetnamespace
  parent.targetnamespace
end