Class: RSpec::OpenHAB::Core::Mocks::BundleResolver
- Inherits:
-
Object
- Object
- RSpec::OpenHAB::Core::Mocks::BundleResolver
- Includes:
- Singleton
- Defined in:
- lib/rspec/openhab/core/mocks/bundle_resolver.rb
Instance Method Summary collapse
-
#initialize ⇒ BundleResolver
constructor
A new instance of BundleResolver.
- #register_class(klass, bundle) ⇒ Object
- #resolve_bundle(clazz) ⇒ Object
Constructor Details
#initialize ⇒ BundleResolver
Returns a new instance of BundleResolver.
13 14 15 |
# File 'lib/rspec/openhab/core/mocks/bundle_resolver.rb', line 13 def initialize @classes = {} end |
Instance Method Details
#register_class(klass, bundle) ⇒ Object
17 18 19 20 |
# File 'lib/rspec/openhab/core/mocks/bundle_resolver.rb', line 17 def register_class(klass, bundle) # ensure we have an individual java class already @classes[klass.become_java!] = bundle end |
#resolve_bundle(clazz) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/rspec/openhab/core/mocks/bundle_resolver.rb', line 22 def resolve_bundle(clazz) bundle = @classes[clazz] return bundle if bundle org.osgi.framework.FrameworkUtil.get_bundle(clazz) end |