Class: RTM::AR::Construct
- Inherits:
-
TMDelegator
- Object
- TMDelegator
- RTM::AR::Construct
- Includes:
- Construct
- Defined in:
- lib/rtm/activerecord/tm_construct.rb
Direct Known Subclasses
Class Method Summary collapse
- .abstract_class? ⇒ Boolean
- .find(*args) ⇒ Object
-
.wrap(obj) ⇒ Object
class_delegate :create.
Methods included from Construct
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
.abstract_class? ⇒ Boolean
8 9 10 |
# File 'lib/rtm/activerecord/tm_construct.rb', line 8 def self.abstract_class? self == Construct end |
.find(*args) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/rtm/activerecord/tm_construct.rb', line 48 def self.find(*args) res = RTM::AR::TMDM.const_get(name.split("::").last).find(*args) if res.respond_to? :each Constructs.wrap(res) else Construct.wrap(res) end end |
.wrap(obj) ⇒ Object
class_delegate :create
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/rtm/activerecord/tm_construct.rb', line 25 def self.wrap(obj) return nil unless obj raise "Double wrapping" if obj.respond_to?(:__getobj__) case obj.class.name when "RTM::AR::TMDM::Topic" Topic.wrap(obj) when "RTM::AR::TMDM::Variant" Variant.wrap(obj) when "RTM::AR::TMDM::Name" Name.wrap(obj) when "RTM::AR::TMDM::Occurrence" Occurrence.wrap(obj) when "RTM::AR::TMDM::Association" Association.wrap(obj) when "RTM::AR::TMDM::Role" Role.wrap(obj) when "RTM::AR::TMDM::TopicMap" TopicMap.wrap(obj) else raise "Can't wrap object. Class for wrapping #{obj.class} unknown (object: #{obj})" end end |