Sha256: f5ec15a770d4168f5e3a710107b986cd6686e68dfa649be70b999dad0376f5e2

Contents?: true

Size: 826 Bytes

Versions: 28

Compression:

Stored size: 826 Bytes

Contents

RailClass.class_eval do
  data_miner do
    process "Ensure CountryRailClass, CountryRailTractionClass, and RailCompanyTractionClass are populated" do
      CountryRailTractionClass.run_data_miner!
      CountryRailClass.run_data_miner!
      RailCompanyTractionClass.run_data_miner!
    end
    
    process "Derive rail class names from CountryRailClass, CountryRailTractionClass, and RailCompanyTractionClass" do
      names = []
      names += CountryRailTractionClass.select("DISTINCT rail_class_name").map(&:rail_class_name)
      names += CountryRailClass.select("DISTINCT rail_class_name").map(&:rail_class_name)
      names += RailCompanyTractionClass.select("DISTINCT rail_class_name").map(&:rail_class_name)
      names.uniq.each do |name|
        RailClass.find_or_create_by_name(name)
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
earth-0.11.6 lib/earth/rail/rail_class/data_miner.rb
earth-0.11.5 lib/earth/rail/rail_class/data_miner.rb
earth-0.11.4 lib/earth/rail/rail_class/data_miner.rb
earth-0.11.3 lib/earth/rail/rail_class/data_miner.rb
earth-0.11.2 lib/earth/rail/rail_class/data_miner.rb
earth-0.11.1 lib/earth/rail/rail_class/data_miner.rb
earth-0.11.0 lib/earth/rail/rail_class/data_miner.rb
earth-0.7.0 lib/earth/rail/rail_class/data_miner.rb