Class: MongoFe::Utils
- Inherits:
-
Object
- Object
- MongoFe::Utils
- Defined in:
- lib/mongo_fe.rb
Class Method Summary collapse
Class Method Details
.split_index_specs(fields = nil) ⇒ Object
156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/mongo_fe.rb', line 156 def self.split_index_specs(fields=nil) specs = [] unless fields.empty? fields.delete(' ').split(/[\s,]+/).each do |s| f= s.split(/[\s:]+/) specs << [f[0].to_sym, f[1].downcase.start_with?('asc') ? Mongo::ASCENDING : Mongo::DESCENDING] end end specs end |