wpscanteam/OptParseValidator

View on GitHub
lib/opt_parse_validator/opts/regexp.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

module OptParseValidator
  # Implementation of the Regexp Option
  # See http://ruby-doc.org/core-2.2.1/Regexp.html#method-c-new for expected values in :options
  class OptRegexp < OptBase
    # @param [ String ] value
    #
    # @return [ Regexp ]
    def validate(value)
      Regexp.new(super(value), attrs[:options])
    end
  end
end