Class: Hydra::RemoteIdentifier::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/hydra/remote_identifier/configuration.rb

Overview

Configuration is responsible for exposing the available RemoteServices and configuring those RemoteServices.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Configuration

Returns a new instance of Configuration.



11
12
13
14
15
# File 'lib/hydra/remote_identifier/configuration.rb', line 11

def initialize(options = {})
  @remote_service_namespace_container = options.fetch(:remote_service_namespace_container, RemoteServices)
  @registration_builder = options.fetch(:registration_builder, Registration)
  @remote_services = {}
end

Instance Attribute Details

#remote_servicesObject (readonly)

Returns the value of attribute remote_services.



18
19
20
# File 'lib/hydra/remote_identifier/configuration.rb', line 18

def remote_services
  @remote_services
end

Instance Method Details

#find_remote_service(service_name) ⇒ Object



20
21
22
# File 'lib/hydra/remote_identifier/configuration.rb', line 20

def find_remote_service(service_name)
  remote_services.fetch(service_name.to_sym)
end

#remote_service(service_name, *args) {|| ... } ⇒ Object

Parameters:

  • service_name (#to_s)
  • args
    • passed through to RemoteService initializer

Yield Parameters:



28
29
30
31
32
33
# File 'lib/hydra/remote_identifier/configuration.rb', line 28

def remote_service(service_name, *args)
  remote_service = find_or_store_remote_service(service_name, *args)
  registration = registration_builder.new(remote_service)
  yield(registration)
  remote_service
end