Class: DataMaps::When::Regex
- Inherits:
-
Base
- Object
- Executable
- Base
- DataMaps::When::Regex
- Defined in:
- lib/data_maps/when/regex.rb
Overview
Condition to check for an regular expression
Instance Attribute Summary collapse
-
#@regex ⇒ Object
readonly
the given regex.
- #regex ⇒ Object readonly
Attributes inherited from Executable
Instance Method Summary collapse
-
#after_initialize ⇒ Object
After initialize callback.
-
#execute(data) ⇒ Object
The check method to evaluate condition on given data.
Methods inherited from Executable
#initialize, valid_collection?
Constructor Details
This class inherits a constructor from DataMaps::Executable
Instance Attribute Details
#@regex ⇒ Object (readonly)
the given regex
7 8 9 |
# File 'lib/data_maps/when/regex.rb', line 7
def @regex
@@regex
end
|
#regex ⇒ Object (readonly)
8 9 10 |
# File 'lib/data_maps/when/regex.rb', line 8 def regex @regex end |
Instance Method Details
#after_initialize ⇒ Object
After initialize callback
11 12 13 |
# File 'lib/data_maps/when/regex.rb', line 11 def after_initialize @regex = Regexp.new(option) end |
#execute(data) ⇒ Object
The check method to evaluate condition on given data
18 19 20 |
# File 'lib/data_maps/when/regex.rb', line 18 def execute(data) !!@regex.match(data) end |