Class: OpenHAB::DSL::Imports::BundleContext

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

Instance Method Summary collapse

Constructor Details

#initialize(event_manager) ⇒ BundleContext



37
38
39
# File 'lib/rspec/openhab/dsl/imports.rb', line 37

def initialize(event_manager)
  @event_manager = event_manager
end

Instance Method Details

#register_service(klass, service, _properties) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/rspec/openhab/dsl/imports.rb', line 41

def register_service(klass, service, _properties)
  klass = klass.to_s
  unless klass == "org.openhab.core.events.EventSubscriber"
    raise NotImplementedError "Don't know how to process service #{service.inspect} of type #{klass.name}"
  end

  @event_manager.add_event_subscriber(service)
end