Class: SpecForge::Attribute::Regex
- Inherits:
-
Attribute
- Object
- Attribute
- SpecForge::Attribute::Regex
- Defined in:
- lib/spec_forge/attribute/regex.rb
Overview
Represents a regular expression attribute using Ruby's Regexp class. This class handles the parsing of regex strings from YAML into actual Regexp objects, including support for standard regex flags (m, n, i, x).
Constant Summary collapse
- KEYWORD_REGEX =
Regular expression pattern that matches attribute keywords with this prefix Used for identifying this attribute type during parsing
/^\/(?<content>[\s\S]+)\/(?<flags>[mnix\s]*)$/i
Instance Attribute Summary collapse
-
#value ⇒ Regexp
(also: #resolved, #resolve)
readonly
The parsed Regexp object.
Instance Method Summary collapse
-
#initialize(input) ⇒ Regex
constructor
Creates a new regex attribute by parsing the input string.
Constructor Details
#initialize(input) ⇒ Regex
Creates a new regex attribute by parsing the input string
44 45 46 47 48 |
# File 'lib/spec_forge/attribute/regex.rb', line 44 def initialize(input) super @value = parse_regex(input) end |
Instance Attribute Details
#value ⇒ Regexp (readonly) Also known as: resolved, resolve
The parsed Regexp object
34 35 36 |
# File 'lib/spec_forge/attribute/regex.rb', line 34 def value @value end |