Class: MaxMind::GeoIP2::Record::Place

Inherits:
Abstract
  • Object
show all
Defined in:
lib/maxmind/geoip2/record/place.rb

Overview

Location data common to different location types.

Direct Known Subclasses

City, Continent, Country, Subdivision

Instance Method Summary collapse

Instance Method Details

#nameString?

The first available localized name in order of preference.

Returns:

  • (String, nil)


19
20
21
22
23
24
25
26
27
28
# File 'lib/maxmind/geoip2/record/place.rb', line 19

def name
  n = names
  return nil if n.nil?

  @locales.each do |locale|
    return n[locale] if n.key?(locale)
  end

  nil
end