Class: ASpaceImport::RecordProxyMgr

Inherits:
Object
  • Object
show all
Defined in:
backend/app/converters/lib/record_proxy.rb

Instance Method Summary collapse

Constructor Details

#initializeRecordProxyMgr

Returns a new instance of RecordProxyMgr.



5
6
7
# File 'backend/app/converters/lib/record_proxy.rb', line 5

def initialize
  @proxies = {}
end

Instance Method Details

#discharge_proxy(proxy_key, proxied_obj) ⇒ Object

the object appears, and the proxy can be discharged



21
22
23
24
25
26
# File 'backend/app/converters/lib/record_proxy.rb', line 21

def discharge_proxy(proxy_key, proxied_obj)
  if @proxies.has_key?(proxy_key)
    @proxies[proxy_key].discharge(proxied_obj)
    @proxies.delete(proxy_key)
  end
end

#get_proxy_for(proxy_key, record_type = nil) ⇒ Object



10
11
12
13
14
15
16
# File 'backend/app/converters/lib/record_proxy.rb', line 10

def get_proxy_for(proxy_key, record_type = nil)
  unless @proxies.has_key?(proxy_key)
    @proxies[proxy_key] = RecordProxy.new(proxy_key, record_type)
  end

  @proxies[proxy_key]
end

#undischargedObject



29
30
31
32
33
34
35
36
37
# File 'backend/app/converters/lib/record_proxy.rb', line 29

def undischarged
  undis = []
  @proxies.each do |type, proxy|
    unless proxy.discharged
      undis << proxy
    end
  end
  undis
end