@@ -79,66 +79,66 @@ module Petstore
7979 # @return Array for valid properties with the reasons
8080 def list_invalid_properties
8181 invalid_properties = Array (String ).new
82- if ! @integer .nil? && @integer > 100
82+ if ! @integer .nil? && @integer .try & . > 100
8383 invalid_properties.push(" invalid value for \" integer\" , must be smaller than or equal to 100." )
8484 end
8585
86- if ! @integer .nil? && @integer < 10
86+ if ! @integer .nil? && @integer .try & . < 10
8787 invalid_properties.push(" invalid value for \" integer\" , must be greater than or equal to 10." )
8888 end
8989
90- if ! @int32 .nil? && @int32 > 200
90+ if ! @int32 .nil? && @int32 .try & . > 200
9191 invalid_properties.push(" invalid value for \" int32\" , must be smaller than or equal to 200." )
9292 end
9393
94- if ! @int32 .nil? && @int32 < 20
94+ if ! @int32 .nil? && @int32 .try & . < 20
9595 invalid_properties.push(" invalid value for \" int32\" , must be greater than or equal to 20." )
9696 end
9797
98- if @number > 543.2
98+ if @number .try & . > 543.2
9999 invalid_properties.push(" invalid value for \" number\" , must be smaller than or equal to 543.2." )
100100 end
101101
102- if @number < 32.1
102+ if @number .try & . < 32.1
103103 invalid_properties.push(" invalid value for \" number\" , must be greater than or equal to 32.1." )
104104 end
105105
106- if ! @float .nil? && @float > 987.6
106+ if ! @float .nil? && @float .try & . > 987.6
107107 invalid_properties.push(" invalid value for \" float\" , must be smaller than or equal to 987.6." )
108108 end
109109
110- if ! @float .nil? && @float < 54.3
110+ if ! @float .nil? && @float .try & . < 54.3
111111 invalid_properties.push(" invalid value for \" float\" , must be greater than or equal to 54.3." )
112112 end
113113
114- if ! @double .nil? && @double > 123.4
114+ if ! @double .nil? && @double .try & . > 123.4
115115 invalid_properties.push(" invalid value for \" double\" , must be smaller than or equal to 123.4." )
116116 end
117117
118- if ! @double .nil? && @double < 67.8
118+ if ! @double .nil? && @double .try & . < 67.8
119119 invalid_properties.push(" invalid value for \" double\" , must be greater than or equal to 67.8." )
120120 end
121121
122- pattern = Regexp .new( /[a-z] /i )
123- if ! @string .nil? && @string !~ pattern
122+ pattern = /[a-z] /i
123+ if ! @string .nil? && @string .try & . !~ pattern
124124 invalid_properties.push(" invalid value for \" string\" , must conform to the pattern #{ pattern } ." )
125125 end
126126
127- if @password .to_s.size > 64
127+ if @password .try & . to_s.try & . size.try & . > 64
128128 invalid_properties.push(" invalid value for \" password\" , the character length must be smaller than or equal to 64." )
129129 end
130130
131- if @password .to_s.size < 10
131+ if @password .try & . to_s.try & . size.try & . < 10
132132 invalid_properties.push(" invalid value for \" password\" , the character length must be greater than or equal to 10." )
133133 end
134134
135- pattern = Regexp .new( /^\d {10} $/ )
136- if ! @pattern_with_digits .nil? && @pattern_with_digits !~ pattern
135+ pattern = /^\d {10} $/
136+ if ! @pattern_with_digits .nil? && @pattern_with_digits .try & . !~ pattern
137137 invalid_properties.push(" invalid value for \" pattern_with_digits\" , must conform to the pattern #{ pattern } ." )
138138 end
139139
140- pattern = Regexp .new( /^image_\d {1,3} $/i )
141- if ! @pattern_with_digits_and_delimiter .nil? && @pattern_with_digits_and_delimiter !~ pattern
140+ pattern = /^image_\d {1,3} $/i
141+ if ! @pattern_with_digits_and_delimiter .nil? && @pattern_with_digits_and_delimiter .try & . !~ pattern
142142 invalid_properties.push(" invalid value for \" pattern_with_digits_and_delimiter\" , must conform to the pattern #{ pattern } ." )
143143 end
144144
@@ -148,21 +148,21 @@ module Petstore
148148 # Check to see if the all the properties in the model are valid
149149 # @return true if the model is valid
150150 def valid ?
151- return false if ! @integer .nil? && @integer > 100
152- return false if ! @integer .nil? && @integer < 10
153- return false if ! @int32 .nil? && @int32 > 200
154- return false if ! @int32 .nil? && @int32 < 20
155- return false if @number > 543.2
156- return false if @number < 32.1
157- return false if ! @float .nil? && @float > 987.6
158- return false if ! @float .nil? && @float < 54.3
159- return false if ! @double .nil? && @double > 123.4
160- return false if ! @double .nil? && @double < 67.8
161- return false if ! @string .nil? && @string !~ Regexp .new( /[a-z] /i )
162- return false if @password .to_s.size > 64
163- return false if @password .to_s.size < 10
164- return false if ! @pattern_with_digits .nil? && @pattern_with_digits !~ Regexp .new( /^\d {10} $/ )
165- return false if ! @pattern_with_digits_and_delimiter .nil? && @pattern_with_digits_and_delimiter !~ Regexp .new( /^image_\d {1,3} $/i )
151+ return false if ! @integer .nil? && @integer .try & . > 100
152+ return false if ! @integer .nil? && @integer .try & . < 10
153+ return false if ! @int32 .nil? && @int32 .try & . > 200
154+ return false if ! @int32 .nil? && @int32 .try & . < 20
155+ return false if @number .try & . > 543.2
156+ return false if @number .try & . < 32.1
157+ return false if ! @float .nil? && @float .try & . > 987.6
158+ return false if ! @float .nil? && @float .try & . < 54.3
159+ return false if ! @double .nil? && @double .try & . > 123.4
160+ return false if ! @double .nil? && @double .try & . < 67.8
161+ return false if ! @string .nil? && @string .try & . !~ /[a-z] /i
162+ return false if @password .try & . to_s.try & . size.try & . > 64
163+ return false if @password .try & . to_s.try & . size.try & . < 10
164+ return false if ! @pattern_with_digits .nil? && @pattern_with_digits .try & . !~ /^\d {10} $/
165+ return false if ! @pattern_with_digits_and_delimiter .nil? && @pattern_with_digits_and_delimiter .try & . !~ /^image_\d {1,3} $/i
166166 true
167167 end
168168
@@ -239,7 +239,7 @@ module Petstore
239239 # Custom attribute writer method with validation
240240 # @param [Object] string Value to be assigned
241241 def string = (string)
242- pattern = Regexp .new( /[a-z] /i )
242+ pattern = /[a-z] /i
243243 if ! string.nil? && string !~ pattern
244244 raise ArgumentError .new(" invalid value for \" string\" , must conform to the pattern #{ pattern } ." )
245245 end
@@ -264,7 +264,7 @@ module Petstore
264264 # Custom attribute writer method with validation
265265 # @param [Object] pattern_with_digits Value to be assigned
266266 def pattern_with_digits = (pattern_with_digits)
267- pattern = Regexp .new( /^\d {10} $/ )
267+ pattern = /^\d {10} $/
268268 if ! pattern_with_digits.nil? && pattern_with_digits !~ pattern
269269 raise ArgumentError .new(" invalid value for \" pattern_with_digits\" , must conform to the pattern #{ pattern } ." )
270270 end
@@ -275,7 +275,7 @@ module Petstore
275275 # Custom attribute writer method with validation
276276 # @param [Object] pattern_with_digits_and_delimiter Value to be assigned
277277 def pattern_with_digits_and_delimiter = (pattern_with_digits_and_delimiter)
278- pattern = Regexp .new( /^image_\d {1,3} $/i )
278+ pattern = /^image_\d {1,3} $/i
279279 if ! pattern_with_digits_and_delimiter.nil? && pattern_with_digits_and_delimiter !~ pattern
280280 raise ArgumentError .new(" invalid value for \" pattern_with_digits_and_delimiter\" , must conform to the pattern #{ pattern } ." )
281281 end
0 commit comments