Class | WSDL::XMLSchema::SimpleRestriction |
In: |
lib/wsdl/xmlSchema/simpleRestriction.rb
|
Parent: | Info |
base | [R] | |
enumeration | [R] | |
length | [RW] | |
pattern | [RW] |
# File lib/wsdl/xmlSchema/simpleRestriction.rb, line 23 23: def initialize 24: super 25: @base = nil 26: @enumeration = [] # NamedElements? 27: @length = nil 28: @pattern = nil 29: end
# File lib/wsdl/xmlSchema/simpleRestriction.rb, line 49 49: def parse_attr(attr, value) 50: case attr 51: when BaseAttrName 52: @base = value 53: end 54: end
# File lib/wsdl/xmlSchema/simpleRestriction.rb, line 38 38: def parse_element(element) 39: case element 40: when EnumerationName 41: Enumeration.new # just a parsing handler 42: when LengthName 43: Length.new # just a parsing handler 44: when PatternName 45: Pattern.new # just a parsing handler 46: end 47: end
# File lib/wsdl/xmlSchema/simpleRestriction.rb, line 31 31: def valid?(value) 32: return false unless check_restriction(value) 33: return false unless check_length(value) 34: return false unless check_pattern(value) 35: true 36: end
# File lib/wsdl/xmlSchema/simpleRestriction.rb, line 62 62: def check_length(value) 63: @length.nil? or value.size == @length 64: end
# File lib/wsdl/xmlSchema/simpleRestriction.rb, line 66 66: def check_pattern(value) 67: @pattern.nil? or @pattern =~ value 68: end