File: named_location.rb

package info (click to toggle)
ruby-maxminddb 0.1.22-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 200 kB
  • sloc: ruby: 926; makefile: 3
file content (33 lines) | stat: -rw-r--r-- 500 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
27
28
29
30
31
32
33
module MaxMindDB
  class Result
    class NamedLocation
      def initialize(raw)
        @raw = raw || {}
      end

      def code
        raw['code']
      end

      def geoname_id
        raw['geoname_id']
      end

      def is_in_european_union
        raw['is_in_european_union']
      end

      def iso_code
        raw['iso_code']
      end

      def name(locale = :en)
        raw['names'] && raw['names'][locale.to_s]
      end

      private

      attr_reader :raw
    end
  end
end