lib/openwfe/contextual.rb
#
# Use reflection to instantiate the new service,and
# add it to the application context
# The service_name can be a String or a Symbol (which will be
# turned into a String).
#
Use reflection to instantiate the new service,and
add it to the application context
The service_name can be a String or a Symbol (which will be
turned into a String).
Use reflection to instantiate the new service and add it to the application context The service_name can be a String or a Symbol ( which will be turned into a String ) .
def init_service (service_name, service_class)
      if service_name
         if there is a service previously registered under the same name,
         make sure to stop before it gets 'overriden' in the
         application context
        s = @application_context[service_name]
        s.stop if s.respond_to?(:stop)
      end
      s = service_class.new(service_name, @application_context)
      unless service_name
         making sure to register the service. servicenew doesn't
         register when there is no service_name
        s.service_name = "{service_class.name}::{s.object_id}"
        @application_context[s.service_name.to_s] = s
      end
      s
    end
def init_service ( service_name , service_class ) if service_name s = @application_context [ service_name ] s . stop if s . respond_to? ( :stop ) end s = service_class . new ( service_name , @application_context ) unless service_name s . service_name = "#{service_class.name}::#{s.object_id}" @application_context [ s . service_name . to_s ] = s end s end
Use reflection to instantiate the new service,and
add it to the application context
The service_name can be a String or a Symbol (which will be
turned into a String).
Use reflection to instantiate the new service and add it to the application context The service_name can be a String or a Symbol ( which will be turned into a String ) .
# # if there is a service previously registered under the same name, # make sure to stop before it gets 'overriden' in the # application context # # making sure to register the service. service#new doesn't # register when there is no service_name
service_name
<not_specific>
service_class
<not_specific>