class OpenAPIRest::Validators::Pattern
Rest pattern validator
Public Class Methods
new(format, value)
click to toggle source
# File lib/openapi_rest/validators/pattern.rb, line 7 def initialize(format, value) @format = format @value = value end
Public Instance Methods
error(key)
click to toggle source
# File lib/openapi_rest/validators/pattern.rb, line 16 def error(key) { key => "invalid format #{@format}" } end
valid?()
click to toggle source
# File lib/openapi_rest/validators/pattern.rb, line 12 def valid? Regexp.new(@format).match(@value) end