Class: SPSTriggerExecute
- Inherits:
-
Object
- Object
- SPSTriggerExecute
- Defined in:
- lib/spstrigger_execute.rb
Instance Method Summary collapse
-
#initialize(x, reg = nil, polyrexdoc = nil, logfile: nil) ⇒ SPSTriggerExecute
constructor
A new instance of SPSTriggerExecute.
- #match_and_execute(topicx, message) ⇒ Object (also: #mae)
- #run(s) ⇒ Object
Constructor Details
#initialize(x, reg = nil, polyrexdoc = nil, logfile: nil) ⇒ SPSTriggerExecute
Returns a new instance of SPSTriggerExecute.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/spstrigger_execute.rb', line 12 def initialize(x, reg=nil, polyrexdoc=nil, logfile: nil) @log = Logger.new logfile,'daily' if logfile dx = if x.is_a? Dynarex then x else buffer, _ = RXFHelper.read x buffer[/^<\?dynarex /] ? Dynarex.new.import(buffer) : Dynarex.new(buffer) end @patterns = dx.to_h if reg and polyrexdoc then xro = XMLRegistryObjects.new(reg, polyrexdoc) @h = xro.to_h define_methods = @h.keys.map {|x| "def #{x}() @h[:#{x}] end"} instance_eval define_methods.join("\n") log 'define_methods : ' + self.public_methods.sort.inspect end end |
Instance Method Details
#match_and_execute(topicx, message) ⇒ Object Also known as: mae
40 41 42 43 |
# File 'lib/spstrigger_execute.rb', line 40 def match_and_execute(topicx, ) results = find_match topicx, prepare_jobs(results) end |
#run(s) ⇒ Object
47 48 49 |
# File 'lib/spstrigger_execute.rb', line 47 def run(s) instance_eval s end |