File: mongo_mapper.rb

package info (click to toggle)
ruby-geocoder 1.5.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 732 kB
  • sloc: ruby: 6,173; makefile: 3
file content (26 lines) | stat: -rw-r--r-- 674 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require 'geocoder/models/base'
require 'geocoder/models/mongo_base'

module Geocoder
  module Model
    module MongoMapper
      include Base
      include MongoBase

      def self.included(base); base.extend(self); end

      private # --------------------------------------------------------------

      def geocoder_file_name;   "mongo_mapper"; end
      def geocoder_module_name; "MongoMapper"; end

      def geocoder_init(options)
        super(options)
        if options[:skip_index] == false
          ensure_index [[ geocoder_options[:coordinates], Mongo::GEO2D ]],
            :min => -180, :max => 180 # create 2d index
        end
      end
    end
  end
end