Class: RubyPitaya::ServiceHolder

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/core/service_holder.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rubypitaya-3.12.1/lib/rubypitaya/core/service_holder.rb

Instance Method Summary collapse

Constructor Details

#initializeServiceHolder

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_servicesObject



22
23
24
# File 'lib/rubypitaya/core/service_holder.rb', line 22

def all_services
  @services.values
end

#has?(key) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/rubypitaya/core/service_holder.rb', line 18

def has?(key)
  @services.has_key?(key)
end