Sha256: 74c81998567a456c3ba70b89363d345e81d45ebfefca1cb53619e6dccdd1938e

Contents?: true

Size: 902 Bytes

Versions: 4

Compression:

Stored size: 902 Bytes

Contents

module RTM::AR
  class Index
    attr_accessor :topic_map
    attr_accessor :itopic_map # the internal AR object
    def initialize(tm)
      @topic_map = tm
      @itopic_map = tm.__getobj__
    end
    def close
    end
    def isAutoUpdated
      true
    end
    def isOpen
      true
    end
    def open
    end
    def reindex
    end
  end
  class LiteralIndex < Index
    def names(value)
      Names.wrap(self.itopic_map.names.find(:all,:conditions => ["value = ?", value]))
    end
    alias :getNames :names
    
    def occurrences(value)
      Occurrences.wrap(self.itopic_map.occurrences.find(:all,:conditions => ["value = ?", value]))
    end
    alias :getOccurrences :occurrences
    
    def variants(value)
      Variants.wrap(TMDM::Variant.find(:all,:conditions => ["value = ?", value]).select{|v| v.topic_map == self.itopic_map})
    end
    alias :getVariants :variants
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rtm-activerecord-0.3.1 lib/rtm/activerecord/literal_index.rb
rtm-activerecord-0.3.0 lib/rtm/activerecord/literal_index.rb
rtm-activerecord-0.2.1 lib/rtm/activerecord/literal_index.rb
rtm-activerecord-0.2.0 lib/rtm/activerecord/literal_index.rb