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.
52 53 54 55 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 52 def initialize(event_manager) @event_manager = event_manager @bundles = [] end |
Instance Attribute Details
#bundles ⇒ Object (readonly)
Returns the value of attribute bundles.
50 51 52 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 50 def bundles @bundles end |
Instance Method Details
#add_bundle_listener(listener) ⇒ Object
68 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 68 def add_bundle_listener(listener); end |
#get_service(klass) ⇒ Object
67 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 67 def get_service(klass); end |
#get_service_reference(klass) ⇒ Object
66 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 66 def get_service_reference(klass); end |
#register_service(klass, service, _properties) ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 57 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 |