Class: WSDL::XMLSchema::SimpleRestriction

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

#initializeSimpleRestriction

Returns a new instance of SimpleRestriction.


25
26
27
28
29
30
31
32
33
# File 'lib/wsdl/xmlSchema/simpleRestriction.rb', line 25

def initialize
  super
  @base = nil
  @enumeration = []   # NamedElements?
  @length = nil
  @maxlength = nil
  @minlength = nil
  @pattern = nil
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base


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

def base
  @base
end

#enumerationObject (readonly)

Returns the value of attribute enumeration


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

def enumeration
  @enumeration
end

#lengthObject

Returns the value of attribute length


20
21
22
# File 'lib/wsdl/xmlSchema/simpleRestriction.rb', line 20

def length
  @length
end

#maxlengthObject

Returns the value of attribute maxlength


21
22
23
# File 'lib/wsdl/xmlSchema/simpleRestriction.rb', line 21

def maxlength
  @maxlength
end

#minlengthObject

Returns the value of attribute minlength


22
23
24
# File 'lib/wsdl/xmlSchema/simpleRestriction.rb', line 22

def minlength
  @minlength
end

#patternObject

Returns the value of attribute pattern


23
24
25
# File 'lib/wsdl/xmlSchema/simpleRestriction.rb', line 23

def pattern
  @pattern
end

Instance Method Details

#parse_attr(attr, value) ⇒ Object


59
60
61
62
63
64
# File 'lib/wsdl/xmlSchema/simpleRestriction.rb', line 59

def parse_attr(attr, value)
  case attr
  when BaseAttrName
    @base = value
  end
end

#parse_element(element) ⇒ Object


44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/wsdl/xmlSchema/simpleRestriction.rb', line 44

def parse_element(element)
  case element
  when EnumerationName
    Enumeration.new
  when LengthName
    Length.new
  when PatternName
    Pattern.new
  when MaxLengthName
    MaxLength.new
  when MinLengthName
    MinLength.new
  end
end

#valid?(value) ⇒ Boolean

Returns:

  • (Boolean)

35
36
37
38
39
40
41
42
# File 'lib/wsdl/xmlSchema/simpleRestriction.rb', line 35

def valid?(value)
  return false unless check_restriction(value)
  return false unless check_length(value)
  return false unless check_maxlength(value)
  return false unless check_minlength(value)
  return false unless check_pattern(value)
  true
end