Class: RSpec::OpenHAB::Core::Mocks::SynchronousExecutor

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/openhab/core/mocks/synchronous_executor.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.instanceObject



21
22
23
# File 'lib/rspec/openhab/core/mocks/synchronous_executor.rb', line 21

def instance
  @instance ||= new(1)
end

Instance Method Details

#execute(runnable) ⇒ Object



32
33
34
# File 'lib/rspec/openhab/core/mocks/synchronous_executor.rb', line 32

def execute(runnable)
  runnable.run
end

#shutdownObject



36
# File 'lib/rspec/openhab/core/mocks/synchronous_executor.rb', line 36

def shutdown; end

#shutdown_nowObject



38
39
40
# File 'lib/rspec/openhab/core/mocks/synchronous_executor.rb', line 38

def shutdown_now
  []
end

#submit(runnable) ⇒ Object



26
27
28
29
30
# File 'lib/rspec/openhab/core/mocks/synchronous_executor.rb', line 26

def submit(runnable)
  runnable.respond_to?(:run) ? runnable.run : runnable.call

  java.util.concurrent.CompletableFuture.completed_future(nil)
end