Module: Earth::Model
- Included in:
- AirConditionerUse, Aircraft, Airline, Airport, AutomobileActivityYear, AutomobileActivityYearType, AutomobileActivityYearTypeFuel, AutomobileFuel, AutomobileMake, AutomobileMakeModel, AutomobileMakeModelYear, AutomobileMakeModelYearVariant, AutomobileMakeYear, AutomobileMakeYearFleet, AutomobileModel, AutomobileSizeClass, AutomobileTypeFuel, AutomobileTypeFuelControl, AutomobileTypeFuelYear, AutomobileTypeFuelYearControl, AutomobileYear, Breed, BreedGender, BtsAircraft, BusClass, BusFuel, BusFuelControl, BusFuelYearControl, Carrier, CarrierMode, CbecsEnergyIntensity, CensusDivision, CensusRegion, ClimateDivision, ClothesMachineUse, CommercialBuildingEnergyConsumptionSurveyResponse, ComputationCarrier, ComputationCarrierInstanceClass, ComputationCarrierRegion, Country, CountryRailClass, CountryRailTraction, CountryRailTractionClass, DietClass, DishwasherUse, EgridCountry, EgridRegion, EgridSubregion, ElectricMarket, ElectricUtility, ElectricityMix, FlightDistanceClass, FlightDistanceClassSeatClass, FlightSeatClass, FlightSegment, FoodGroup, Fuel, FuelPrice, FuelType, FuelYear, Gender, GreenButtonAdoption, GreenhouseGas, Industry, IndustryProduct, IndustryProductLine, IndustrySector, LodgingClass, MecsEnergy, MecsRatio, MerchantCategory, MerchantCategoryIndustry, Naics2002, Naics2002Naics2007Concordance, Naics2002Sic1987Concordance, Naics2007, NationalTransitDatabaseCompany, NationalTransitDatabaseMode, NationalTransitDatabaseRecord, PetroleumAdministrationForDefenseDistrict, ProductLine, ProductLineIndustryProduct, RailClass, RailCompany, RailFuel, RailTraction, ResidenceAppliance, ResidenceClass, ResidenceFuelPrice, ResidenceFuelType, ResidentialEnergyConsumptionSurveyResponse, Sector, ShipmentMode, Sic1987, Species, State, Urbanity, ZipCode
- Defined in:
- lib/earth/model.rb
Defined Under Namespace
Modules: SafeFinders, Schema
Class Method Summary collapse
Class Method Details
.extend_mining(target) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/earth/model.rb', line 20 def Model.extend_mining(target) if Earth.mine_original_sources path = File.join(File.dirname(target.source_file), File.basename(target.source_file, '.rb'), 'data_miner') require path if File.exist?(path + '.rb') target.data_miner_script.prepend_once :process, :create_table! else target.data_miner_script.prepend_once :sql, "Brighter Planet's reference data", "http://data.brighterplanet.com/#{target.to_s.underscore.pluralize}.sql" end target.data_miner_script.append_once :process, :run_data_miner_on_parent_associations! end |
.extended(target) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/earth/model.rb', line 6 def Model.extended(target) target.extend SafeFinders target.extend Schema target.mattr_accessor :source_file self.registry << target target.source_file = caller.first.split(':').first extend_mining(target) end |
.registry ⇒ Object
16 17 18 |
# File 'lib/earth/model.rb', line 16 def Model.registry @registry ||= [] end |