Class: CountryData::Data

Inherits:
FrozenRecord::Base
  • Object
show all
Defined in:
lib/country_data/data.rb

Class Method Summary collapse

Class Method Details

.continentsObject



15
16
17
# File 'lib/country_data/data.rb', line 15

def self.continents
    all.collect(&:continent).uniq
end

.find(arg) ⇒ Object



6
7
8
9
# File 'lib/country_data/data.rb', line 6

def self.find(arg)
    arg = arg.to_s.upcase if arg.class == Symbol
    where(alpha2: arg)
end

.find_by_official_language(arg) ⇒ Object



11
12
13
# File 'lib/country_data/data.rb', line 11

def self.find_by_official_language(arg)
    all.select { |c| c if c.languages_official.include? arg.to_s }
end