Class: RTM::AR::TopicMaps

Inherits:
TMSetDelegator show all
Defined in:
lib/rtm/activerecord/set_wrapper.rb

Instance Method Summary collapse

Methods inherited from TMSetDelegator

#&, #==, #add, #add_all, #content_class, #delete, #each, #empty?, #find, #first, #include?, #initialize, #last, #method_missing, #old_method_missing, #old_respond_to?, #respond_to?, #size, #to_s, wrap

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::TMSetDelegator

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RTM::AR::TMSetDelegator

Instance Method Details

#[](obj) ⇒ Object



46
47
48
49
50
51
52
53
54
# File 'lib/rtm/activerecord/set_wrapper.rb', line 46

def [](obj)
  # support for getting topic_map by base_locator
  if obj.is_a? String
    # return wrap(__getobj__.find { |tm| tm.base_locator == obj })
    return wrap(TMDM::TopicMap.find_by_base_locator(obj))
  end
  # normal index retrieval
  super
end

#wrap(obj) ⇒ Object



56
57
58
# File 'lib/rtm/activerecord/set_wrapper.rb', line 56

def wrap(obj)
  TopicMap.wrap(obj)
end