Sha256: 856b76f516d2319e2db1db511dbbf5cbf7c667b193731a41bdb5b651eabb3ce4

Contents?: true

Size: 457 Bytes

Versions: 3

Compression:

Stored size: 457 Bytes

Contents

require "csv"
require "set"

numbers = Set.new

Dir.glob("#{__dir__}/../tmp/csv/*.csv").each do |path|
  File.open(path) do |f|
    f.gets # skip first line
    csv = CSV.new(f, headers: :first_row)
    csv.each do |row|
      next unless (num = row["市外局番"])

      numbers << num
    end
  end
end

output = numbers.sort_by {|n| [-n.length, n] }.join("\n") + "\n"

File.write("#{__dir__}/../lib/phonenumber_jp/area_codes_for_matching.csv", output)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
phonenumber_jp-0.1.4 scripts/update_area_codes_list.rb
phonenumber_jp-0.1.3 scripts/update_area_codes_list.rb
phonenumber_jp-0.1.2 scripts/update_area_codes_list.rb