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-1.0.0 lib/earth/rail/rail_class/data_miner.rb
earth-0.12.4 lib/earth/rail/rail_class/data_miner.rb
earth-0.12.3 lib/earth/rail/rail_class/data_miner.rb
earth-0.12.2 lib/earth/rail/rail_class/data_miner.rb
earth-0.12.1 lib/earth/rail/rail_class/data_miner.rb
earth-0.12.0 lib/earth/rail/rail_class/data_miner.rb
earth-0.11.20 lib/earth/rail/rail_class/data_miner.rb
earth-0.11.19 lib/earth/rail/rail_class/data_miner.rb
earth-0.11.18 lib/earth/rail/rail_class/data_miner.rb
earth-0.11.17 lib/earth/rail/rail_class/data_miner.rb
earth-0.11.16 lib/earth/rail/rail_class/data_miner.rb
earth-0.11.15 lib/earth/rail/rail_class/data_miner.rb
earth-0.11.14 lib/earth/rail/rail_class/data_miner.rb
earth-0.11.13 lib/earth/rail/rail_class/data_miner.rb
earth-0.11.12 lib/earth/rail/rail_class/data_miner.rb
earth-0.11.11 lib/earth/rail/rail_class/data_miner.rb
earth-0.11.10 lib/earth/rail/rail_class/data_miner.rb
earth-0.11.9 lib/earth/rail/rail_class/data_miner.rb
earth-0.11.8 lib/earth/rail/rail_class/data_miner.rb
earth-0.11.7 lib/earth/rail/rail_class/data_miner.rb