Skip to content

Commit

Permalink
Remove draft?
Browse files Browse the repository at this point in the history
It is already handled by `DataFile`
  • Loading branch information
movermeyer committed Apr 19, 2022
1 parent 6d8336d commit 8576039
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 19 deletions.
7 changes: 1 addition & 6 deletions lib/cldr/export/data/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,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

Expand Down
12 changes: 5 additions & 7 deletions lib/cldr/export/data/currencies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/cldr/export/data/languages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def initialize(locale:, minimum_draft_level:)

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
Expand Down
3 changes: 1 addition & 2 deletions lib/cldr/export/data/numbers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/cldr/export/data/subdivisions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def initialize(locale:, minimum_draft_level:)

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
Expand Down
2 changes: 1 addition & 1 deletion lib/cldr/export/data/territories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def initialize(locale:, minimum_draft_level:)

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
Expand Down
2 changes: 1 addition & 1 deletion lib/cldr/export/data/units.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 8576039

Please sign in to comment.