From c24c606d4103edf8f87cdc706f6a9c637627cb3f Mon Sep 17 00:00:00 2001 From: Michael Overmeyer Date: Tue, 19 Apr 2022 10:08:16 -0400 Subject: [PATCH] Remove `draft?` It is already handled by `DataFile` --- lib/cldr/export/data/base.rb | 7 +------ lib/cldr/export/data/currencies.rb | 12 +++++------- lib/cldr/export/data/languages.rb | 2 +- lib/cldr/export/data/numbers.rb | 3 +-- lib/cldr/export/data/subdivisions.rb | 2 +- lib/cldr/export/data/territories.rb | 2 +- lib/cldr/export/data/units.rb | 2 +- 7 files changed, 11 insertions(+), 19 deletions(-) diff --git a/lib/cldr/export/data/base.rb b/lib/cldr/export/data/base.rb index 7075baab..58a5de54 100644 --- a/lib/cldr/export/data/base.rb +++ b/lib/cldr/export/data/base.rb @@ -27,12 +27,7 @@ def []=(key, value) protected - def draft?(node) - draft = node.attribute("draft") - draft && draft.value == "unconfirmed" - end - - def alt?(node) + def alt?(node) # TODO: Move this into DataFile !node.attribute("alt").nil? end diff --git a/lib/cldr/export/data/currencies.rb b/lib/cldr/export/data/currencies.rb index cb74a210..ad0ee431 100644 --- a/lib/cldr/export/data/currencies.rb +++ b/lib/cldr/export/data/currencies.rb @@ -20,13 +20,11 @@ def currencies def currency(node) data = select(node, "displayName").each_with_object({}) do |node, result| - unless draft?(node) - if node.attribute("count") - count = node.attribute("count").value.to_sym - result[count] = node.content - else - result[:name] = node.content - end + if node.attribute("count") + count = node.attribute("count").value.to_sym + result[count] = node.content + else + result[:name] = node.content end end diff --git a/lib/cldr/export/data/languages.rb b/lib/cldr/export/data/languages.rb index cec1484a..9c866503 100644 --- a/lib/cldr/export/data/languages.rb +++ b/lib/cldr/export/data/languages.rb @@ -13,7 +13,7 @@ def initialize(locale) def languages @languages ||= select("localeDisplayNames/languages/language").each_with_object({}) do |node, result| - result[Cldr::Export.to_i18n(node.attribute("type").value)] = node.content unless draft?(node) || alt?(node) + result[Cldr::Export.to_i18n(node.attribute("type").value)] = node.content unless alt?(node) end end end diff --git a/lib/cldr/export/data/numbers.rb b/lib/cldr/export/data/numbers.rb index d0cf3672..a576e025 100644 --- a/lib/cldr/export/data/numbers.rb +++ b/lib/cldr/export/data/numbers.rb @@ -42,7 +42,7 @@ def currency def symbols select("numbers/symbols/*").each_with_object({}) do |node, result| - result[name(node).to_sym] = node.content unless draft?(node) + result[name(node).to_sym] = node.content end end @@ -60,7 +60,6 @@ def format(type) pattern_count_node = pattern_node.attribute("count") - next if draft?(pattern_node) pattern_key = pattern_key_node ? pattern_key_node.value : :default if pattern_count_node diff --git a/lib/cldr/export/data/subdivisions.rb b/lib/cldr/export/data/subdivisions.rb index 5f8088bf..0fbd693e 100644 --- a/lib/cldr/export/data/subdivisions.rb +++ b/lib/cldr/export/data/subdivisions.rb @@ -13,7 +13,7 @@ def initialize(locale) def subdivisions @subdivisions ||= select("localeDisplayNames/subdivisions/subdivision").each_with_object({}) do |node, result| - result[node.attribute("type").value.to_sym] = node.content unless draft?(node) || alt?(node) + result[node.attribute("type").value.to_sym] = node.content unless alt?(node) end end end diff --git a/lib/cldr/export/data/territories.rb b/lib/cldr/export/data/territories.rb index 8cac48a4..75e3f70c 100644 --- a/lib/cldr/export/data/territories.rb +++ b/lib/cldr/export/data/territories.rb @@ -13,7 +13,7 @@ def initialize(locale) def territories @territories ||= select("localeDisplayNames/territories/territory").each_with_object({}) do |node, result| - result[node.attribute("type").value.to_sym] = node.content unless draft?(node) || alt?(node) + result[node.attribute("type").value.to_sym] = node.content unless alt?(node) end end end diff --git a/lib/cldr/export/data/units.rb b/lib/cldr/export/data/units.rb index 7e4a028d..7d977ecd 100644 --- a/lib/cldr/export/data/units.rb +++ b/lib/cldr/export/data/units.rb @@ -31,7 +31,7 @@ def units(node) def unit(node) node.xpath("unitPattern").each_with_object({}) do |node, result| count = node.attribute("count") ? node.attribute("count").value.to_sym : :one - result[count] = node.content unless draft?(node) + result[count] = node.content end end