Class: RubyPitaya::ServiceHolder
- Inherits:
-
Object
- Object
- RubyPitaya::ServiceHolder
- Defined in:
- lib/rubypitaya/core/service_holder.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #add(key, service) ⇒ Object
- #all_services ⇒ Object
- #has?(key) ⇒ Boolean
-
#initialize ⇒ ServiceHolder
constructor
A new instance of ServiceHolder.
Constructor Details
#initialize ⇒ ServiceHolder
Returns a new instance of ServiceHolder.
5 6 7 |
# File 'lib/rubypitaya/core/service_holder.rb', line 5 def initialize @services = {} end |
Instance Method Details
#[](key) ⇒ Object
14 15 16 |
# File 'lib/rubypitaya/core/service_holder.rb', line 14 def [](key) @services[key].client end |
#add(key, service) ⇒ Object
9 10 11 12 |
# File 'lib/rubypitaya/core/service_holder.rb', line 9 def add(key, service) check_service_instance(service) @services[key] = service end |
#all_services ⇒ Object
22 23 24 |
# File 'lib/rubypitaya/core/service_holder.rb', line 22 def all_services @services.values end |
#has?(key) ⇒ Boolean
18 19 20 |
# File 'lib/rubypitaya/core/service_holder.rb', line 18 def has?(key) @services.has_key?(key) end |