267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
|
# File 'lib/puppet/pops/types/type_factory.rb', line 267
def self.pattern(*regular_expressions)
patterns = regular_expressions.map do |re|
case re
when String
re_t = PRegexpType.new(re)
re_t.regexp re_t
when Regexp
PRegexpType.new(re)
when PRegexpType
re
when PPatternType
re.patterns
else
raise ArgumentError, "Only String, Regexp, Pattern-Type, and Regexp-Type are allowed: got '#{re.class}"
end
end.flatten.uniq
PPatternType.new(patterns)
end
|