1
# WSDL4R - XMLSchema simpleContent restriction definition for WSDL.
2
# Copyright (C) 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
4
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
5
# redistribute it and/or modify it under the same terms of Ruby's license;
6
# either the dual license version in 2003, or any later version.
10
require 'xsd/namedelements'
17
class SimpleRestriction < Info
19
attr_reader :enumeration
21
attr_accessor :pattern
26
@enumeration = [] # NamedElements?
32
return false unless check_restriction(value)
33
return false unless check_length(value)
34
return false unless check_pattern(value)
38
def parse_element(element)
41
Enumeration.new # just a parsing handler
43
Length.new # just a parsing handler
45
Pattern.new # just a parsing handler
49
def parse_attr(attr, value)
58
def check_restriction(value)
59
@enumeration.empty? or @enumeration.include?(value)
62
def check_length(value)
63
@length.nil? or value.size == @length
66
def check_pattern(value)
67
@pattern.nil? or @pattern =~ value