class WSDL::XMLSchema::SimpleRestriction
Attributes
attributes[R]
base[R]
enumeration[R]
fixed[R]
fractiondigits[RW]
length[RW]
maxexclusive[RW]
maxinclusive[RW]
maxlength[RW]
minexclusive[RW]
mininclusive[RW]
minlength[RW]
pattern[RW]
totaldigits[RW]
whitespace[RW]
Public Class Methods
new()
click to toggle source
Calls superclass method
WSDL::Info::new
# File lib/wsdl/xmlSchema/simpleRestriction.rb, line 34 def initialize super @base = nil @enumeration = [] # NamedElements? @length = nil @maxlength = nil @minlength = nil @pattern = nil @fixed = {} @attributes = XSD::NamedElements.new end
Public Instance Methods
enumeration?()
click to toggle source
# File lib/wsdl/xmlSchema/simpleRestriction.rb, line 55 def enumeration? !@enumeration.empty? end
parse_attr(attr, value)
click to toggle source
# File lib/wsdl/xmlSchema/simpleRestriction.rb, line 100 def parse_attr(attr, value) case attr when BaseAttrName @base = value end end
parse_element(element)
click to toggle source
# File lib/wsdl/xmlSchema/simpleRestriction.rb, line 59 def parse_element(element) case element when LengthName Length.new when MinLengthName MinLength.new when MaxLengthName MaxLength.new when PatternName Pattern.new when EnumerationName Enumeration.new when WhiteSpaceName WhiteSpace.new when MaxInclusiveName MaxInclusive.new when MaxExclusiveName MaxExclusive.new when MinExclusiveName MinExclusive.new when MinInclusiveName MinInclusive.new when TotalDigitsName TotalDigits.new when FractionDigitsName FractionDigits.new when AttributeName o = Attribute.new @attributes << o o when AttributeGroupName o = AttributeGroup.new @attributes << o o when AnyAttributeName o = AnyAttribute.new @attributes << o o end end
valid?(value)
click to toggle source
# File lib/wsdl/xmlSchema/simpleRestriction.rb, line 46 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
Private Instance Methods
check_length(value)
click to toggle source
# File lib/wsdl/xmlSchema/simpleRestriction.rb, line 113 def check_length(value) @length.nil? or value.size == @length end
check_maxlength(value)
click to toggle source
# File lib/wsdl/xmlSchema/simpleRestriction.rb, line 117 def check_maxlength(value) @maxlength.nil? or value.size <= @maxlength end
check_minlength(value)
click to toggle source
# File lib/wsdl/xmlSchema/simpleRestriction.rb, line 121 def check_minlength(value) @minlength.nil? or value.size >= @minlength end
check_pattern(value)
click to toggle source
# File lib/wsdl/xmlSchema/simpleRestriction.rb, line 125 def check_pattern(value) @pattern.nil? or @pattern =~ value end
check_restriction(value)
click to toggle source
# File lib/wsdl/xmlSchema/simpleRestriction.rb, line 109 def check_restriction(value) @enumeration.empty? or @enumeration.include?(value) end