Class: Ezid::ProxyIdentifier

Inherits:
Object
  • Object
show all
Defined in:
lib/ezid/proxy_identifier.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ ProxyIdentifier

Returns a new instance of ProxyIdentifier.



7
8
9
10
# File 'lib/ezid/proxy_identifier.rb', line 7

def initialize(id)
  @id = id
  @__real = nil
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object (protected)



14
15
16
17
18
19
# File 'lib/ezid/proxy_identifier.rb', line 14

def method_missing(name, *args, &block)
  if __real.nil?
    self.__real = Identifier.find(id)
  end
  __real.send(name, *args, &block)
end

Instance Attribute Details

#__realObject

Returns the value of attribute __real.



5
6
7
# File 'lib/ezid/proxy_identifier.rb', line 5

def __real
  @__real
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/ezid/proxy_identifier.rb', line 4

def id
  @id
end