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)


39
40
41
42
43
44
45
46
47
48
# File 'lib/maxmind/geoip2/record/place.rb', line 39

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

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

  nil
end