Class: WorldLite::Country

Inherits:
Object
  • Object
show all
Defined in:
lib/worldlite/country.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCountry

Returns a new instance of Country.



82
83
84
# File 'lib/worldlite/country.rb', line 82

def initialize
  @kind = 'CTRY'   # default to 'sovereign' country - why? why not?
end

Class Method Details

.allObject



87
88
89
90
# File 'lib/worldlite/country.rb', line 87

def self.all
  ## return all countries as an ary e.g. use Country.all
  WORLD
end

Instance Method Details

#eu?Boolean

Returns:

  • (Boolean)


41
# File 'lib/worldlite/country.rb', line 41

def eu?()   @eu   end

#euro?Boolean

Returns:

  • (Boolean)


42
# File 'lib/worldlite/country.rb', line 42

def euro?() @euro end

#factbook_urlObject



72
73
74
# File 'lib/worldlite/country.rb', line 72

def factbook_url
  "http://www.cia.gov/library/publications/the-world-factbook/geos/#{factbook}.html"
end

#fifa?Boolean

Returns:

  • (Boolean)


49
50
51
52
# File 'lib/worldlite/country.rb', line 49

def fifa?
  # note: for now assumes if no fifa code it's not a fifa member country
   @fifa.nil? ? false : true
end

#inspectObject



77
78
79
80
# File 'lib/worldlite/country.rb', line 77

def inspect
  ## note: for now use a shorter pretty print (pp) format
  "<#Country name=|#{name}|, key=|#{key}|, to_path=|#{to_path}|>"
end

#iso?Boolean

Returns:

  • (Boolean)


44
45
46
47
# File 'lib/worldlite/country.rb', line 44

def iso?
   # note: for now assumes if no iso code it's not an iso listed country
   @alpha3.nil? ? false : true
end

#slugObject



54
55
56
# File 'lib/worldlite/country.rb', line 54

def slug
  slugify(name)
end

#to_path(opts = {}) ⇒ Object



58
59
60
61
# File 'lib/worldlite/country.rb', line 58

def to_path( opts={} )
  ## e.g. europe/at-austria
  "#{slugify(continent_name)}/#{key}-#{slugify(name)}"
end

#un?Boolean

:schengen, # flag

:commonwealth # flag

Returns:

  • (Boolean)


40
# File 'lib/worldlite/country.rb', line 40

def un?()   @un   end

#wikidata_urlObject



68
69
70
# File 'lib/worldlite/country.rb', line 68

def wikidata_url
  "http://www.wikidata.org/wiki/Q#{wikidata}"
end

#wikpedia_urlObject



64
65
66
# File 'lib/worldlite/country.rb', line 64

def wikpedia_url
  "http://en.wikipedia.org/wiki/#{wikpedia}"
end