Class: Contracts::Constraints::Regex
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(regex) ⇒ Regex
constructor
A new instance of Regex.
- #matches?(value) ⇒ Boolean
Methods inherited from Base
Constructor Details
#initialize(regex) ⇒ Regex
Returns a new instance of Regex.
234 |
# File 'lib/contracts.rb', line 234 def initialize(regex) = @regex = regex |
Instance Method Details
#description ⇒ Object
236 |
# File 'lib/contracts.rb', line 236 def description = "matching #{@regex.inspect}" |
#matches?(value) ⇒ Boolean
235 |
# File 'lib/contracts.rb', line 235 def matches?(value) = value.is_a?(String) && @regex.match?(value) |