Class: Nucleon::Event::Regex
- Inherits:
-
Object
- Object
- Nucleon::Event::Regex
- Defined in:
- lib/nucleon/event/regex.rb
Instance Method Summary collapse
-
#check(source) ⇒ Object
—.
-
#normalize(reload) ⇒ Object
—————————————————————————– Regular expression event interface.
-
#pattern(default = '') ⇒ Object
—————————————————————————– Property accessors / modifiers.
-
#pattern=(pattern) ⇒ Object
—.
-
#render ⇒ Object
—————————————————————————– Operations.
Instance Method Details
#check(source) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/nucleon/event/regex.rb', line 39 def check(source) if pattern.empty? logger.warn("Can not check regex pattern because it is empty") else success = source.match(/#{pattern}/) logger.debug("Checking regex event with pattern #{pattern}: #{success.inspect}") return success end return true end |
#normalize(reload) ⇒ Object
Regular expression event interface
9 10 11 12 13 14 15 |
# File 'lib/nucleon/event/regex.rb', line 9 def normalize(reload) super if get(:string) myself.pattern = delete(:string) end end |
#pattern(default = '') ⇒ Object
Property accessors / modifiers
20 21 22 |
# File 'lib/nucleon/event/regex.rb', line 20 def pattern(default = '') return get(:pattern, default) end |
#pattern=(pattern) ⇒ Object
26 27 28 |
# File 'lib/nucleon/event/regex.rb', line 26 def pattern=pattern set(:pattern, string(pattern)) end |
#render ⇒ Object
Operations
33 34 35 |
# File 'lib/nucleon/event/regex.rb', line 33 def render return "#{name}:#{pattern}" end |