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



19
20
21
# File 'lib/rspec/openhab/core/mocks/synchronous_executor.rb', line 19

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

Instance Method Details

#execute(runnable) ⇒ Object



30
31
32
# File 'lib/rspec/openhab/core/mocks/synchronous_executor.rb', line 30

def execute(runnable)
  runnable.run
end

#shutdownObject



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

def shutdown; end

#shutdown_nowObject



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

def shutdown_now
  []
end

#submit(runnable) ⇒ Object



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

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

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