Class: RTM::AR::Locator

Inherits:
TMDelegator show all
Includes:
Locator
Defined in:
lib/rtm/activerecord/locators.rb

Direct Known Subclasses

ItemIdentifier, SubjectIdentifier, SubjectLocator

Class Method Summary collapse

Methods inherited from TMDelegator

#__getobj__, #__setobj__, aka_property, class_delegate, delegate, #eql?, equality, #hash, #initialize, parent, property, property_set, wrapper_cache

Constructor Details

This class inherits a constructor from RTM::AR::TMDelegator

Class Method Details

.wrap(obj) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rtm/activerecord/locators.rb', line 27

def self.wrap(obj)
  return nil unless obj
  raise "Double wrapping" if obj.respond_to?(:__getobj__)
  case obj.class.name
  when "RTM::AR::TMDM::ItemIdentifier"
    ItemIdentifier.wrap(obj)
  when "RTM::AR::TMDM::SubjectIdentifier"
    SubjectIdentifier.wrap(obj)
  when "RTM::AR::TMDM::SubjectLocator"
    SubjectLocator.wrap(obj)
  else
    raise "Can't wrap object. Class for wrapping #{obj.class} unknown (object: #{obj})"
  end
end