Method: Dnif::MultiAttribute.decode
- Defined in:
- lib/dnif/multi_attribute.rb
.decode(multi) ⇒ Object
Returns the original MongoDB ID created from a Sphinx ID. Only works if the ID was created from a MongoDB ID before!
Parameters:
- multi
-
Sphinx “multi” attribute to translate back
45 46 47 48 49 50 |
# File 'lib/dnif/multi_attribute.rb', line 45 def self.decode(multi) multi = multi.split(',') if not multi.is_a?(Array) offset = 0 return multi.collect { |x| (x.to_i - (offset += 0x0100)).chr }.join("") end |