class Parameters::Types::Regexp
Public Class Methods
coerce(value)
click to toggle source
Coerces a value into a Regular Expression.
@param [#to_regexp, to_s] value
The value to coerce.
@return [::Regexp]
The coerced Regular Expression.
# File lib/parameters/types/regexp.rb, line 16 def self.coerce(value) if value.respond_to?(:to_regexp) value.to_regexp else ::Regexp.new(value.to_s) end end