Class: WorldLite::Country
- Inherits:
-
Object
- Object
- WorldLite::Country
- Defined in:
- lib/worldlite/country.rb
Class Method Summary collapse
Instance Method Summary collapse
- #eu? ⇒ Boolean
- #euro? ⇒ Boolean
- #factbook_url ⇒ Object
- #fifa? ⇒ Boolean
-
#initialize ⇒ Country
constructor
A new instance of Country.
- #inspect ⇒ Object
- #iso? ⇒ Boolean
- #slug ⇒ Object
- #to_path(opts = {}) ⇒ Object
-
#un? ⇒ Boolean
:schengen, # flag :commonwealth # flag.
- #wikidata_url ⇒ Object
- #wikpedia_url ⇒ Object
Constructor Details
#initialize ⇒ Country
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
.all ⇒ Object
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
41 |
# File 'lib/worldlite/country.rb', line 41 def eu?() @eu end |
#euro? ⇒ Boolean
42 |
# File 'lib/worldlite/country.rb', line 42 def euro?() @euro end |
#factbook_url ⇒ Object
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
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 |
#inspect ⇒ Object
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
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 |
#slug ⇒ Object
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
40 |
# File 'lib/worldlite/country.rb', line 40 def un?() @un end |
#wikidata_url ⇒ Object
68 69 70 |
# File 'lib/worldlite/country.rb', line 68 def wikidata_url "http://www.wikidata.org/wiki/Q#{wikidata}" end |
#wikpedia_url ⇒ Object
64 65 66 |
# File 'lib/worldlite/country.rb', line 64 def wikpedia_url "http://en.wikipedia.org/wiki/#{wikpedia}" end |