Class: Ion::Indices::Sort
Instance Attribute Summary
Attributes inherited from Ion::Index
#name, #options
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Ion::Index
del, #initialize, #search
Constructor Details
This class inherits a constructor from Ion::Index
Class Method Details
.deindex(record) ⇒ Object
17
18
19
|
# File 'lib/ion/indices/sort.rb', line 17
def self.deindex(record)
key_for(record).del
end
|
Instance Method Details
#index(record) ⇒ Object
3
4
5
6
7
8
|
# File 'lib/ion/indices/sort.rb', line 3
def index(record)
value = value_for(record)
value = transform(value)
key_for(record).hset name, value
end
|
#spec ⇒ Object
21
22
23
24
|
# File 'lib/ion/indices/sort.rb', line 21
def spec
@spec ||= self.class.key[@options.model.name]["*->#{name}"]
end
|
The function that the string passes thru before going to the db.
11
12
13
14
15
|
# File 'lib/ion/indices/sort.rb', line 11
def transform(value)
str = value.to_s.downcase.strip
str = str[4..-1] if str[0..3] == "the " str
end
|