Class: Coral::RegexpEvent
- Defined in:
- lib/coral_core/event/regexp_event.rb
Constant Summary collapse
- TYPE =
Properties
:regexp
Instance Attribute Summary
Attributes inherited from Event
Attributes inherited from Core
Instance Method Summary collapse
-
#check(source) ⇒ Object
—————————————————————————– Event handling.
-
#export ⇒ Object
—————————————————————————– Import / Export.
-
#initialize(options = {}) ⇒ RegexpEvent
constructor
—————————————————————————– Constructor / Destructor.
-
#pattern ⇒ Object
—————————————————————————– Property accessors / modifiers.
-
#pattern=(pattern) ⇒ Object
—.
Methods inherited from Event
build_info, build_info!, create, instance, instance!, #property, #set_properties, #set_property, split_event_string, #type
Methods inherited from Core
#inspect, logger, #logger, logger=, ui
Methods inherited from Config
#[], #[]=, array, #array, #clear, #defaults, #delete, ensure, filter, #filter, #get, #get_array, #get_hash, hash, #hash, #import, #init, init, init_flat, #set, string, #string, string_map, #string_map, #symbol, symbol, #symbol_map, symbol_map, test, #test
Methods included from Mixin::ConfigOptions
#clear_options, #contexts, #get_options, #set_options
Methods included from Mixin::ConfigCollection
#all_properties, #clear_properties, #delete_property, #get_property, #save_properties, #set_property
Methods included from Mixin::Lookup
#hiera, #hiera_config, #initialized?, #lookup, #lookup_array, #lookup_hash, #normalize
Methods included from Mixin::ConfigOps
Constructor Details
#initialize(options = {}) ⇒ RegexpEvent
Constructor / Destructor
13 14 15 16 17 18 19 20 21 |
# File 'lib/coral_core/event/regexp_event.rb', line 13 def initialize( = {}) [:type] = TYPE super() if .has_key?(:string) self.pattern = [:string] end end |
Instance Method Details
#check(source) ⇒ Object
Event handling
46 47 48 49 50 51 52 53 |
# File 'lib/coral_core/event/regexp_event.rb', line 46 def check(source) if source.match(/#{pattern}/) logger.debug("MATCH! -> #{pattern} matched #{source}") return true end logger.debug("nothing -> #{pattern} - #{source}") return false end |
#export ⇒ Object
Import / Export
39 40 41 |
# File 'lib/coral_core/event/regexp_event.rb', line 39 def export return "#{type}:#{pattern}" end |
#pattern ⇒ Object
Property accessors / modifiers
26 27 28 |
# File 'lib/coral_core/event/regexp_event.rb', line 26 def pattern return property(:pattern, '', :string) end |
#pattern=(pattern) ⇒ Object
32 33 34 |
# File 'lib/coral_core/event/regexp_event.rb', line 32 def pattern=pattern set_property(:pattern, string(pattern)) end |