Class: OpenHAB::DSL::Imports::BundleContext
- Inherits:
-
Object
- Object
- OpenHAB::DSL::Imports::BundleContext
- Defined in:
- lib/rspec/openhab/dsl/imports.rb
Instance Attribute Summary collapse
-
#bundles ⇒ Object
readonly
Returns the value of attribute bundles.
Instance Method Summary collapse
- #add_bundle_listener(listener) ⇒ Object
- #get_service(klass) ⇒ Object
- #get_service_reference(klass) ⇒ Object
-
#initialize(event_manager) ⇒ BundleContext
constructor
A new instance of BundleContext.
- #register_service(klass, service, _properties) ⇒ Object
Constructor Details
#initialize(event_manager) ⇒ BundleContext
Returns a new instance of BundleContext.
39 40 41 42 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 39 def initialize(event_manager) @event_manager = event_manager @bundles = [] end |
Instance Attribute Details
#bundles ⇒ Object (readonly)
Returns the value of attribute bundles.
37 38 39 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 37 def bundles @bundles end |
Instance Method Details
#add_bundle_listener(listener) ⇒ Object
55 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 55 def add_bundle_listener(listener); end |
#get_service(klass) ⇒ Object
54 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 54 def get_service(klass); end |
#get_service_reference(klass) ⇒ Object
53 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 53 def get_service_reference(klass); end |
#register_service(klass, service, _properties) ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 44 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 |