Class: TopSecret::Filters::Regex
- Inherits:
-
Object
- Object
- TopSecret::Filters::Regex
- Defined in:
- lib/top_secret/filters/regex.rb
Overview
Applies regex-based filtering to extract matching text from input.
Instance Attribute Summary collapse
-
#label ⇒ String
readonly
The label applied to matching content.
Instance Method Summary collapse
-
#call(input) ⇒ Array<String>
Applies the regex to the input and returns all matches.
-
#initialize(label:, regex:) ⇒ Regex
constructor
A new instance of Regex.
Constructor Details
#initialize(label:, regex:) ⇒ Regex
Returns a new instance of Regex.
12 13 14 15 |
# File 'lib/top_secret/filters/regex.rb', line 12 def initialize(label:, regex:) @label = label @regex = regex end |
Instance Attribute Details
#label ⇒ String (readonly)
Returns The label applied to matching content.
8 9 10 |
# File 'lib/top_secret/filters/regex.rb', line 8 def label @label end |
Instance Method Details
#call(input) ⇒ Array<String>
Applies the regex to the input and returns all matches.
21 22 23 |
# File 'lib/top_secret/filters/regex.rb', line 21 def call(input) input.scan(regex) end |