lib/reality.rb in reality-0.0.2 vs lib/reality.rb in reality-0.0.3

- old
+ new

@@ -1,15 +1,34 @@ require 'infoboxer' +require 'yaml' module Reality - require_relative 'reality/infoboxer_templates' - - # basic functionality - %w[measure].each do |mod| - require_relative "reality/#{mod}" + def self.require_(*modules) + modules.flatten.flat_map{|pattern| + Dir[File.expand_path("../reality/#{pattern}.rb", __FILE__)] + }.each(&Kernel.method(:require)) end + # basic functionality + require_ %w[version refinements config measure geo tz_offset] + require_ %w[util/parsers util/formatters] + + # engines + require_ %w[infoboxer_templates wikidata] + Infoboxer.user_agent = "Reality/#{VERSION} (https://github.com/molybdenum-99/reality; zverok.offline@gmail.com)" + # entities - %w[country].each do |mod| - require_relative "reality/#{mod}" + require_ %w[entity list] + require_ %w[definitions/*] + require_ %w[methods] + + extend Methods + + def self.reload! + require_ %w[definitions/*] end + + # extras + require_ %w[extras/open_weather_map extras/geonames] + include Extras::OpenWeatherMap + include Extras::Geonames end