Class: WSDL::XMLSchema::SimpleType

Inherits:
Info
  • Object
show all
Defined in:
lib/wsdl/xmlSchema/simpleType.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

#initialize(name = nil) ⇒ SimpleType

Returns a new instance of SimpleType.



37
38
39
40
41
# File 'lib/wsdl/xmlSchema/simpleType.rb', line 37

def initialize(name = nil)
  super()
  @name = name
  @restriction = nil
end

Instance Attribute Details

#nameObject

Returns the value of attribute name



18
19
20
# File 'lib/wsdl/xmlSchema/simpleType.rb', line 18

def name
  @name
end

#restrictionObject (readonly)

Returns the value of attribute restriction



19
20
21
# File 'lib/wsdl/xmlSchema/simpleType.rb', line 19

def restriction
  @restriction
end

Instance Method Details

#baseObject



29
30
31
32
33
34
35
# File 'lib/wsdl/xmlSchema/simpleType.rb', line 29

def base
  if @restriction
    @restriction.base
  else
    raise ArgumentError.new("incomplete simpleType")
  end
end

#check_lexical_format(value) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/wsdl/xmlSchema/simpleType.rb', line 21

def check_lexical_format(value)
  if @restriction
    check_restriction(value)
  else
    raise ArgumentError.new("incomplete simpleType")
  end
end

#parse_attr(attr, value) ⇒ Object



55
56
57
58
59
60
# File 'lib/wsdl/xmlSchema/simpleType.rb', line 55

def parse_attr(attr, value)
  case attr
  when NameAttrName
    @name = XSD::QName.new(targetnamespace, value.source)
  end
end

#parse_element(element) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/wsdl/xmlSchema/simpleType.rb', line 47

def parse_element(element)
  case element
  when RestrictionName
    @restriction = SimpleRestriction.new
    @restriction
  end
end

#targetnamespaceObject



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

def targetnamespace
  parent.targetnamespace
end