Class: Sunspot::TypeField

Inherits:
Object
  • Object
show all
Defined in:
lib/lunr/sunspot.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.alias(dest_class, source_class_name) ⇒ Object



37
38
39
40
# File 'lib/lunr/sunspot.rb', line 37

def alias(dest_class, source_class_name)
  @@inverted = nil # invalidate cache
  aliases[dest_class] = source_class_name
end

.aliasesObject



42
43
44
# File 'lib/lunr/sunspot.rb', line 42

def aliases
  @@aliases ||= {}
end

.aliases_invertedObject



46
47
48
# File 'lib/lunr/sunspot.rb', line 46

def aliases_inverted
  @@inverted ||= aliases.invert
end

Instance Method Details

#old_to_indexedObject



51
# File 'lib/lunr/sunspot.rb', line 51

alias_method :old_to_indexed, :to_indexed

#to_indexed(clazz) ⇒ Object



53
54
55
# File 'lib/lunr/sunspot.rb', line 53

def to_indexed clazz
  self.class.aliases[clazz] || clazz.name
end