Module: Reality

Defined in:
lib/reality/country.rb,
lib/reality.rb,
lib/reality/measure.rb,
lib/reality/measure/unit.rb

Overview

NB: all of this is early drafts, so may look naive and sub-optimal. Just stay tuned!

Defined Under Namespace

Classes: Country, Measure

Class Method Summary collapse

Class Method Details

.countries(*names) ⇒ Object



275
276
277
278
# File 'lib/reality/country.rb', line 275

def Reality.countries(*names)
  names = Country.by_continents.keys.sort if names.empty?
  Country::List.new(*names)
end

.country(name) ⇒ Object



268
269
270
271
272
273
# File 'lib/reality/country.rb', line 268

def Reality.country(name)
  page = wp.get(name) or return nil
  # FIXME: not very reliable, as some fictional countries, aliances
  #   and country groups also have this infobox. Or maybe it is acceptable?..
  page.templates(name: 'Infobox country').empty? ? nil : Country.new(page)
end

.Measure(*arg) ⇒ Object



89
90
91
# File 'lib/reality/measure.rb', line 89

def Reality.Measure(*arg)
  Measure.new(*arg)
end

.wpObject



280
281
282
# File 'lib/reality/country.rb', line 280

def Reality.wp
  @wp ||= Infoboxer.wp # while Infoboxer recreates wp for each request
end