Class: OpenHAB::DSL::Rules::AutomationRule

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/openhab/suspend_rules.rb

Overview

I’d prefer to prepend a module, but I can’t because of github.com/jruby/jruby/issues/6966#issuecomment-1172983776

Instance Method Summary collapse

Instance Method Details

#execute(mod = nil, inputs = nil) ⇒ Object

rubocop:disable Style/ClassAndModuleChildren



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rspec/openhab/suspend_rules.rb', line 9

def execute(mod = nil, inputs = nil)
  if SuspendRules.suspended?
    logger.trace("Skipping execution of #{uid} because rules are suspended.")
    return
  end

  # super
  ::OpenHAB::DSL.import_presets
  thread_local(RULE_NAME: name) do
    logger.trace { "Execute called with mod (#{mod&.to_string}) and inputs (#{inputs.inspect})" }
    logger.trace { "Event details #{inputs["event"].inspect}" } if inputs&.key?("event")
    trigger_conditions(inputs).process(mod: mod, inputs: inputs) do
      process_queue(create_queue(inputs), mod, inputs)
    end
  end
end