Class: OptParseValidator::OptRegexp

Inherits:
OptBase
  • Object
show all
Defined in:
lib/opt_parse_validator/opts/regexp.rb

Overview

Implementation of the Regexp Option See ruby-doc.org/core-2.2.1/Regexp.html#method-c-new for expected values in :options

Instance Attribute Summary

Attributes inherited from OptBase

#attrs, #option, #required

Instance Method Summary collapse

Methods inherited from OptBase

#advanced?, #alias?, #append_help_messages, #choices, #default, #help_message_for_default, #help_messages, #initialize, #normalize, #required?, #required_unless, #to_long, #to_s, #to_sym, #value_if_empty

Constructor Details

This class inherits a constructor from OptParseValidator::OptBase

Instance Method Details

#validate(value) ⇒ Regexp

Parameters:

  • value (String)

Returns:

  • (Regexp)


10
11
12
# File 'lib/opt_parse_validator/opts/regexp.rb', line 10

def validate(value)
  Regexp.new(super(value), attrs[:options])
end