From 2729c7a9bb791bde2d5c203de9a80d74c752f8cf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 15 Jul 2026 13:51:38 +0000 Subject: [PATCH 1/8] Bump rubocop-shopify from 2.18.0 to 3.0.1 Bumps [rubocop-shopify](https://github.com/Shopify/ruby-style-guide) from 2.18.0 to 3.0.1. - [Release notes](https://github.com/Shopify/ruby-style-guide/releases) - [Commits](https://github.com/Shopify/ruby-style-guide/compare/v2.18.0...v3.0.1) --- updated-dependencies: - dependency-name: rubocop-shopify dependency-version: 3.0.1 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 06076c4..d17ab54 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -47,7 +47,7 @@ GEM rake rdoc semver2 - json (2.17.1.2) + json (2.21.1) jwt (2.10.3) base64 language_server-protocol (3.17.0.6) @@ -79,8 +79,8 @@ GEM multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) - parallel (1.27.0) - parser (3.3.10.0) + parallel (2.1.0) + parser (3.3.11.1) ast (~> 2.4.1) racc power_assert (3.0.1) @@ -109,25 +109,26 @@ GEM erb psych (>= 4.0.0) tsort - regexp_parser (2.11.3) + regexp_parser (2.12.0) reline (0.6.3) io-console (~> 0.5) - rubocop (1.81.7) + rubocop (1.88.2) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) - parallel (~> 1.10) + parallel (>= 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.9.3, < 3.0) - rubocop-ast (>= 1.47.1, < 2.0) + rubocop-ast (>= 1.49.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.48.0) + rubocop-ast (1.50.0) parser (>= 3.3.7.2) - prism (~> 1.4) - rubocop-shopify (2.18.0) - rubocop (~> 1.62) + prism (~> 1.7) + rubocop-shopify (3.0.1) + lint_roller + rubocop (~> 1.72, >= 1.72.1) ruby-lsp (0.26.10) language_server-protocol (~> 3.17.0) prism (>= 1.2, < 2.0) @@ -143,7 +144,7 @@ GEM tsort (0.2.0) unicode-display_width (3.2.0) unicode-emoji (~> 4.1) - unicode-emoji (4.1.0) + unicode-emoji (4.2.0) PLATFORMS aarch64-linux From 104d577822ba1a16983e1cb030493bed6789d13f Mon Sep 17 00:00:00 2001 From: Michael Overmeyer Date: Mon, 27 Jul 2026 18:00:54 -0400 Subject: [PATCH 2/8] `rubocop -a` --- lib/cldr/format/datetime/base.rb | 4 ++-- lib/cldr/ldml/attribute.rb | 2 +- lib/cldr/validate_upstream_assumptions.rb | 2 +- lib/core_ext/hash/deep_prune.rb | 2 +- lib/core_ext/hash/deep_sort.rb | 2 +- test/export/data/currencies_test.rb | 3 +-- test/export/data/languages_test.rb | 3 +-- test/export/data/plurals_test.rb | 16 ++++++++-------- test/export/data/territories_test.rb | 3 +-- test/export/data/timezones_test.rb | 1 - 10 files changed, 17 insertions(+), 21 deletions(-) diff --git a/lib/cldr/format/datetime/base.rb b/lib/cldr/format/datetime/base.rb index 3cda201..0880c52 100644 --- a/lib/cldr/format/datetime/base.rb +++ b/lib/cldr/format/datetime/base.rb @@ -14,9 +14,9 @@ def initialize(format, calendar) protected def compile(format) - (class << self; self; end).class_eval(<<-code) + (class << self; self; end).class_eval(<<-CODE) def apply(date, options = {}); #{compile_format(format)}; end - code +CODE end # compile_format("EEEE, d. MMMM y") # => diff --git a/lib/cldr/ldml/attribute.rb b/lib/cldr/ldml/attribute.rb index 9a08df7..5c082bf 100644 --- a/lib/cldr/ldml/attribute.rb +++ b/lib/cldr/ldml/attribute.rb @@ -14,7 +14,7 @@ def parse(attlist, comments) attr_reader :element_name, :attribute_name, :type, :mode - def initialize(element_name, attribute_name, type, mode, status, deprecated) # rubocop:disable Metrics/ParameterLists + def initialize(element_name, attribute_name, type, mode, status, deprecated) @element_name = element_name @attribute_name = attribute_name @type = type diff --git a/lib/cldr/validate_upstream_assumptions.rb b/lib/cldr/validate_upstream_assumptions.rb index ee5294d..3afbe45 100644 --- a/lib/cldr/validate_upstream_assumptions.rb +++ b/lib/cldr/validate_upstream_assumptions.rb @@ -29,7 +29,7 @@ def validate_aliases_only_in_root_locale # Aliases need explicit special handling. Once that handling has been added, # the element chain covered by the handling gets added to this list. - SUPPORTED_ALIAS_ELEMENT_CHAINS = [ # rubocop:disable Metrics/CollectionLiteralLength + SUPPORTED_ALIAS_ELEMENT_CHAINS = [ "/ldml/dates/calendars/calendar[@type=\"gregorian\"]/dayPeriods/dayPeriodContext[@type=\"format\"]/dayPeriodWidth[@type=\"narrow\"]/alias", "/ldml/dates/calendars/calendar[@type=\"gregorian\"]/dayPeriods/dayPeriodContext[@type=\"format\"]/dayPeriodWidth[@type=\"wide\"]/alias", "/ldml/dates/calendars/calendar[@type=\"gregorian\"]/dayPeriods/dayPeriodContext[@type=\"stand-alone\"]/dayPeriodWidth[@type=\"abbreviated\"]/alias", diff --git a/lib/core_ext/hash/deep_prune.rb b/lib/core_ext/hash/deep_prune.rb index 9d820f3..bd7e319 100644 --- a/lib/core_ext/hash/deep_prune.rb +++ b/lib/core_ext/hash/deep_prune.rb @@ -9,4 +9,4 @@ def deep_prune!(comparator = ->(v) { v.is_a?(Hash) && v.empty? }) end end -Hash.send(:include, DeepPrune) +Hash.include DeepPrune diff --git a/lib/core_ext/hash/deep_sort.rb b/lib/core_ext/hash/deep_sort.rb index a957670..94339bc 100644 --- a/lib/core_ext/hash/deep_sort.rb +++ b/lib/core_ext/hash/deep_sort.rb @@ -85,4 +85,4 @@ def <=>(other) end end -Hash.send(:include, DeepSort::DeepSortHash) +Hash.include DeepSort::DeepSortHash diff --git a/test/export/data/currencies_test.rb b/test/export/data/currencies_test.rb index 75e21f1..a781c53 100644 --- a/test/export/data/currencies_test.rb +++ b/test/export/data/currencies_test.rb @@ -5,8 +5,7 @@ class TestCldrCurrencies < Test::Unit::TestCase test "currencies :de" do - # rubocop:disable Layout/MultilineArrayLineBreaks - codes = [ # rubocop:disable Metrics/CollectionLiteralLength + codes = [ :ADP, :AED, :AFA, :AFN, :ALL, :AMD, :ANG, :AOA, :AOK, :AON, :AOR, :ARA, :ARP, :ARS, :ATS, :AUD, :AWG, :AZM, :AZN, :BAD, :BAM, :BBD, :BDT, :BEC, :BEF, :BEL, :BGL, :BGN, :BHD, :BIF, :BMD, :BND, :BOB, diff --git a/test/export/data/languages_test.rb b/test/export/data/languages_test.rb index f2c993d..6431e08 100644 --- a/test/export/data/languages_test.rb +++ b/test/export/data/languages_test.rb @@ -5,8 +5,7 @@ class TestCldrDataLanguages < Test::Unit::TestCase test "languages :de" do - # rubocop:disable Layout/MultilineArrayLineBreaks - codes = [ # rubocop:disable Metrics/CollectionLiteralLength + codes = [ :aa, :ab, :ace, :ach, :ada, :ady, :ae, :aeb, :af, :afh, :agq, :ain, :ak, :akk, :akz, :ale, :aln, :alt, :am, :an, :ang, :anp, :ar, :"ar-001", :arc, :arn, :aro, :arp, diff --git a/test/export/data/plurals_test.rb b/test/export/data/plurals_test.rb index 2a17eb0..d2d4906 100644 --- a/test/export/data/plurals_test.rb +++ b/test/export/data/plurals_test.rb @@ -8,11 +8,11 @@ def cldr_rules end test "compiles to valid ruby code" do - assert_nothing_raised { eval(cldr_rules.to_ruby) } # rubocop:disable Security/Eval + assert_nothing_raised { eval(cldr_rules.to_ruby) } end test "evals to a hash containing plural rule and keys per locale" do - data = eval(cldr_rules.to_ruby) # rubocop:disable Security/Eval + data = eval(cldr_rules.to_ruby) assert(Hash === data) assert(Proc === data[:de][:i18n][:plural][:rule]) assert_equal([:one, :other], data[:de][:i18n][:plural][:keys]) @@ -182,7 +182,7 @@ def cldr_rules test "eval n in" do n = 3.3 - assert_equal(false, eval(Cldr::Export::Data::Plurals::Rule.parse("n mod 100 in 3..6").to_ruby, binding)) # rubocop:disable Security/Eval + assert_equal(false, eval(Cldr::Export::Data::Plurals::Rule.parse("n mod 100 in 3..6").to_ruby, binding)) end test "codes with missing spaces" do @@ -194,7 +194,7 @@ def cldr_rules test "n negative" do # one: i = 1 and v = 0 @integer 1 # other: @integer 0, 2~16, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, … - fn = eval(cldr_rules[:de].to_ruby) # rubocop:disable Security/Eval + fn = eval(cldr_rules[:de].to_ruby) assert_equal(:one, fn.call(-1)) assert_equal(:one, fn.call("-1")) assert_equal(:one, fn.call(1)) @@ -206,7 +206,7 @@ def cldr_rules test "n digit" do # one: n = 0..1 or n = 11..99 @integer 0, 1, 11~24 @decimal 0.0, 1.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0 # other: @integer 2~10, 100~106, 1000, 10000, 100000, 1000000, … @decimal 0.1~0.9, 1.1~1.7, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, … - fn = eval(cldr_rules[:tzm].to_ruby) # rubocop:disable Security/Eval + fn = eval(cldr_rules[:tzm].to_ruby) assert_equal(:one, fn.call(0)) assert_equal(:one, fn.call(1)) assert_equal(:one, fn.call(11)) @@ -221,7 +221,7 @@ def cldr_rules test "n string" do # one: i = 1 and v = 0 or i = 0 and t = 1 @integer 1 @decimal 0.1, 0.01, 0.10, 0.001, 0.010, 0.100, 0.0001, 0.0010, 0.0100, 0.1000 # other: @integer 0, 2~16, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0, 0.2~1.6, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, … - fn = eval(cldr_rules[:pt].to_ruby) # rubocop:disable Security/Eval + fn = eval(cldr_rules[:pt].to_ruby) assert_equal(:one, fn.call("1")) assert_equal(:one, fn.call("0.00100")) assert_equal(:one, fn.call("-0.01")) @@ -235,7 +235,7 @@ def cldr_rules # one: v = 0 and i % 10 = 1 and i % 100 != 11 or f % 10 = 1 and f % 100 != 11 @integer 1, 21, 31, 41, 51, 61, 71, 81, 101, 1001, … @decimal 0.1, 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 10.1, 100.1, 1000.1, … # few: v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14 @integer 2~4, 22~24, 32~34, 42~44, 52~54, 62, 102, 1002, … @decimal 0.2~0.4, 1.2~1.4, 2.2~2.4, 3.2~3.4, 4.2~4.4, 5.2, 10.2, 100.2, 1000.2, … # other: @integer 0, 5~19, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0, 0.5~1.0, 1.5~2.0, 2.5~2.7, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, … - fn = eval(cldr_rules[:hr].to_ruby) # rubocop:disable Security/Eval + fn = eval(cldr_rules[:hr].to_ruby) assert_equal(:one, fn.call(1)) assert_equal(:one, fn.call("21")) assert_equal(:one, fn.call("131")) @@ -260,7 +260,7 @@ def cldr_rules # one: i = 0,1 @integer 0, 1 @decimal 0.0~1.5 # many: e = 0 and i != 0 and i % 1000000 = 0 and v = 0 or e != 0..5 @integer 1000000, 1c6, 2c6, 3c6, 4c6, 5c6, 6c6, … @decimal 1.0000001c6, 1.1c6, 2.0000001c6, 2.1c6, 3.0000001c6, 3.1c6, … # other: @integer 2~17, 100, 1000, 10000, 100000, 1c3, 2c3, 3c3, 4c3, 5c3, 6c3, … @decimal 2.0~3.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, 1.0001c3, 1.1c3, 2.0001c3, 2.1c3, 3.0001c3, 3.1c3, … - fn = eval(cldr_rules[:fr].to_ruby) # rubocop:disable Security/Eval + fn = eval(cldr_rules[:fr].to_ruby) assert_equal(:one, fn.call(0)) assert_equal(:one, fn.call(1)) assert_equal(:many, fn.call(1000000)) diff --git a/test/export/data/territories_test.rb b/test/export/data/territories_test.rb index 15ab326..1b5a6f8 100644 --- a/test/export/data/territories_test.rb +++ b/test/export/data/territories_test.rb @@ -5,8 +5,7 @@ class TestCldrDataTerritories < Test::Unit::TestCase test "territories :de" do - # rubocop:disable Layout/MultilineArrayLineBreaks - codes = [ # rubocop:disable Metrics/CollectionLiteralLength + codes = [ :"001", :"002", :"003", :"005", :"009", :"011", :"013", :"014", :"015", :"017", :"018", :"019", :"021", :"029", :"030", :"034", :"035", :"039", :"053", :"054", :"057", :"061", :"142", :"143", diff --git a/test/export/data/timezones_test.rb b/test/export/data/timezones_test.rb index 3375f54..452c989 100644 --- a/test/export/data/timezones_test.rb +++ b/test/export/data/timezones_test.rb @@ -5,7 +5,6 @@ class TestCldrDataTimezones < Test::Unit::TestCase test "timezones :de" do - # rubocop:disable Layout/MultilineArrayLineBreaks codes_subset = [ :"Etc/Unknown", :"Europe/Tirane", :"Asia/Yerevan", :"Antarctica/Vostok", :"Antarctica/DumontDUrville", :"Europe/Vienna", :"Europe/Brussels", From d3c4c658a6e3c5bdbedb91f43413059bb1582414 Mon Sep 17 00:00:00 2001 From: Michael Overmeyer Date: Mon, 27 Jul 2026 18:02:31 -0400 Subject: [PATCH 3/8] `bundle exec rubocop -A --only=Style/MutableConstant` --- lib/cldr/export/data/aliases.rb | 2 +- lib/cldr/export/data/variables.rb | 2 +- lib/cldr/export/deep_validate_keys.rb | 2 +- lib/cldr/format/date.rb | 4 ++-- lib/cldr/format/decimal/number.rb | 2 +- lib/cldr/format/time.rb | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/cldr/export/data/aliases.rb b/lib/cldr/export/data/aliases.rb index cd94e1f..e25a410 100644 --- a/lib/cldr/export/data/aliases.rb +++ b/lib/cldr/export/data/aliases.rb @@ -5,7 +5,7 @@ module Export module Data class Aliases < Base # only these aliases will be exported - ALIAS_TAGS = ["languageAlias", "territoryAlias"] + ALIAS_TAGS = ["languageAlias", "territoryAlias"].freeze def initialize super(nil) diff --git a/lib/cldr/export/data/variables.rb b/lib/cldr/export/data/variables.rb index cc97b93..aac0549 100644 --- a/lib/cldr/export/data/variables.rb +++ b/lib/cldr/export/data/variables.rb @@ -5,7 +5,7 @@ module Export module Data class Variables < Base # only these variables will be exported - VARIABLE_IDS = ["$grandfathered", "$language", "$territory", "$script", "$variant"] + VARIABLE_IDS = ["$grandfathered", "$language", "$territory", "$script", "$variant"].freeze def initialize super(nil) diff --git a/lib/cldr/export/deep_validate_keys.rb b/lib/cldr/export/deep_validate_keys.rb index b3be6e0..86654da 100644 --- a/lib/cldr/export/deep_validate_keys.rb +++ b/lib/cldr/export/deep_validate_keys.rb @@ -48,7 +48,7 @@ def validate(hash, component, key_path = []) ["."], [".", "."], ], - } + }.freeze def paths_match?(pattern, key) raise NotImplementedError, "Multiple * in pattern is unsupported" if pattern.count { |element| element == "*" } > 1 diff --git a/lib/cldr/format/date.rb b/lib/cldr/format/date.rb index 841993a..fb17bf6 100644 --- a/lib/cldr/format/date.rb +++ b/lib/cldr/format/date.rb @@ -20,7 +20,7 @@ class Date < Datetime::Base "E" => :weekday, "e" => :weekday_local, "c" => :weekday_local_stand_alone, - } + }.freeze def era(date, pattern, length) raise NotImplementedError, "not implemented" @@ -119,7 +119,7 @@ def day(date, pattern, length) end end - WEEKDAY_KEYS = [:sun, :mon, :tue, :wed, :thu, :fri, :sat] + WEEKDAY_KEYS = [:sun, :mon, :tue, :wed, :thu, :fri, :sat].freeze def weekday(date, pattern, length) key = WEEKDAY_KEYS[date.wday] diff --git a/lib/cldr/format/decimal/number.rb b/lib/cldr/format/decimal/number.rb index a78fbca..0f95de9 100644 --- a/lib/cldr/format/decimal/number.rb +++ b/lib/cldr/format/decimal/number.rb @@ -6,7 +6,7 @@ class Decimal class Number attr_reader :prefix, :suffix, :integer_format, :fraction_format, :symbols - DEFAULT_SYMBOLS = { group: ",", decimal: ".", plus_sign: "+", minus_sign: "-" } + DEFAULT_SYMBOLS = { group: ",", decimal: ".", plus_sign: "+", minus_sign: "-" }.freeze FORMAT_PATTERN = /([^0#,\.]*)([0#,\.]+)([^0#,\.]*)$/ def initialize(format, symbols = {}) diff --git a/lib/cldr/format/time.rb b/lib/cldr/format/time.rb index ab97428..4c29bff 100644 --- a/lib/cldr/format/time.rb +++ b/lib/cldr/format/time.rb @@ -17,7 +17,7 @@ class Time < Datetime::Base "Z" => :timezone, "v" => :timezone_generic_non_location, "V" => :timezone_metazone, - } + }.freeze def period(time, pattern, length) calendar[:periods][:format][:wide][time.strftime("%p").downcase.to_sym] From d61c03b034a4e5808ebb563418dcf611de3428ae Mon Sep 17 00:00:00 2001 From: Michael Overmeyer Date: Mon, 27 Jul 2026 18:03:58 -0400 Subject: [PATCH 4/8] `bundle exec rubocop -A --only=Style/ReduceToHash` --- lib/cldr/export/data/aliases.rb | 4 ++-- lib/cldr/export/data/lists.rb | 4 ++-- lib/cldr/export/data/locale_display_pattern.rb | 6 +++--- lib/cldr/export/data/numbers.rb | 4 ++-- lib/cldr/export/data/plural_rules.rb | 12 ++++++------ lib/cldr/export/data/timezones.rb | 4 ++-- lib/cldr/export/data/units.rb | 12 ++++++------ 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lib/cldr/export/data/aliases.rb b/lib/cldr/export/data/aliases.rb index e25a410..45a4069 100644 --- a/lib/cldr/export/data/aliases.rb +++ b/lib/cldr/export/data/aliases.rb @@ -16,8 +16,8 @@ def initialize private def aliases - ALIAS_TAGS.each_with_object({}) do |alias_tag, ret| - ret[alias_tag.sub("Alias", "")] = alias_for(alias_tag) + ALIAS_TAGS.to_h do |alias_tag| + [alias_tag.sub("Alias", ""), alias_for(alias_tag)] end end diff --git a/lib/cldr/export/data/lists.rb b/lib/cldr/export/data/lists.rb index 073df68..b0a7d38 100644 --- a/lib/cldr/export/data/lists.rb +++ b/lib/cldr/export/data/lists.rb @@ -33,8 +33,8 @@ def list_pattern(list_pattern) end def get_pattern_parts(list_pattern) - select(list_pattern, "listPatternPart").each_with_object({}) do |part, part_ret| - part_ret[part.attribute("type").value.to_sym] = part.content + select(list_pattern, "listPatternPart").to_h do |part| + [part.attribute("type").value.to_sym, part.content] end end diff --git a/lib/cldr/export/data/locale_display_pattern.rb b/lib/cldr/export/data/locale_display_pattern.rb index 9459563..d6a79ed 100644 --- a/lib/cldr/export/data/locale_display_pattern.rb +++ b/lib/cldr/export/data/locale_display_pattern.rb @@ -12,9 +12,9 @@ def initialize(locale) private def locale_display_pattern - @locale_display_pattern ||= select("localeDisplayNames/localeDisplayPattern/*").each_with_object({}) do |node, result| - result[node.name.underscore] = node.content - end + @locale_display_pattern ||= select("localeDisplayNames/localeDisplayPattern/*").to_h do |node| + [node.name.underscore, node.content] + end end end end diff --git a/lib/cldr/export/data/numbers.rb b/lib/cldr/export/data/numbers.rb index 1ca2ea7..7f20c14 100644 --- a/lib/cldr/export/data/numbers.rb +++ b/lib/cldr/export/data/numbers.rb @@ -39,8 +39,8 @@ def symbols(number_system) return xpath_to_symbols_alias(aliased["path"]) end - select("numbers/symbols[@numberSystem=\"#{number_system}\"]/*").each_with_object({}) do |node, result| - result[name(node).to_sym] = node.content + select("numbers/symbols[@numberSystem=\"#{number_system}\"]/*").to_h do |node| + [name(node).to_sym, node.content] end end diff --git a/lib/cldr/export/data/plural_rules.rb b/lib/cldr/export/data/plural_rules.rb index 4319120..76e7947 100644 --- a/lib/cldr/export/data/plural_rules.rb +++ b/lib/cldr/export/data/plural_rules.rb @@ -12,9 +12,9 @@ def initialize(locale) super() find_rules(locale).each_pair do |rule_type, rule_data| - self[rule_type.to_sym] = rule_data.each_with_object({}) do |rule, ret| - ret[rule.attributes["count"].text] = rule.text - end + self[rule_type.to_sym] = rule_data.to_h do |rule| + [rule.attributes["count"].text, rule.text] + end end deep_sort! @@ -23,9 +23,9 @@ def initialize(locale) private def sources - @sources ||= ["plurals", "ordinals"].each_with_object({}) do |source_name, ret| - ret[source_name] = Cldr::Export::DataFile.parse(File.read("#{Cldr::Export::Data::RAW_DATA.directory}/supplemental/#{source_name}.xml")) - end + @sources ||= ["plurals", "ordinals"].to_h do |source_name| + [source_name, Cldr::Export::DataFile.parse(File.read("#{Cldr::Export::Data::RAW_DATA.directory}/supplemental/#{source_name}.xml"))] + end end def find_rules(locale) diff --git a/lib/cldr/export/data/timezones.rb b/lib/cldr/export/data/timezones.rb index 4f48281..3c3bcff 100644 --- a/lib/cldr/export/data/timezones.rb +++ b/lib/cldr/export/data/timezones.rb @@ -55,8 +55,8 @@ def metazones protected def nodes_to_hash(nodes) - nodes.each_with_object({}) do |node, result| - result[node.name.to_sym] = node.content + nodes.to_h do |node| + [node.name.to_sym, node.content] end end end diff --git a/lib/cldr/export/data/units.rb b/lib/cldr/export/data/units.rb index 893b737..efe5cba 100644 --- a/lib/cldr/export/data/units.rb +++ b/lib/cldr/export/data/units.rb @@ -18,8 +18,8 @@ def initialize(locale) private def unit_length - select("units/unitLength").each_with_object({}) do |node, result| - result[node.attribute("type").value.underscore.to_sym] = units(node) + select("units/unitLength").to_h do |node| + [node.attribute("type").value.underscore.to_sym, units(node)] end end @@ -27,8 +27,8 @@ def units(node) aliased = select_single(node, "alias") return units_xpath_to_key(aliased.attribute("path").value) if aliased - node.xpath("unit").each_with_object({}) do |node, result| - result[node.attribute("type").value.underscore.to_sym] = unit(node) + node.xpath("unit").to_h do |node| + [node.attribute("type").value.underscore.to_sym, unit(node)] end end @@ -47,8 +47,8 @@ def unit(node) end def duration_unit - select("units/durationUnit").each_with_object({}) do |node, result| - result[node.attribute("type").value.underscore.to_sym] = node.xpath("durationUnitPattern").first.content + select("units/durationUnit").to_h do |node| + [node.attribute("type").value.underscore.to_sym, node.xpath("durationUnitPattern").first.content] end end From e4a0f5b07816f98a7f6444f01880433102e1184a Mon Sep 17 00:00:00 2001 From: Michael Overmeyer Date: Mon, 27 Jul 2026 18:04:55 -0400 Subject: [PATCH 5/8] `bundle exec rubocop -A --only=Style/MapJoin` --- lib/cldr/export/data/plurals/rules.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cldr/export/data/plurals/rules.rb b/lib/cldr/export/data/plurals/rules.rb index ff4f85e..a4dab45 100644 --- a/lib/cldr/export/data/plurals/rules.rb +++ b/lib/cldr/export/data/plurals/rules.rb @@ -39,7 +39,7 @@ def to_ruby(options = {}) ruby = namespaces.reverse.inject(ruby) { |ruby, namespace| "{ #{namespace.inspect} => #{ruby} }" } "#{locale.inspect} => #{ruby}" end.join(",\n") - code = code.split("\n").map(&:to_s).join("\n") + code = code.split("\n").join("\n") "{ #{code} }" end end From b062bbeb23b0bb8266a4cec808e651695958e42a Mon Sep 17 00:00:00 2001 From: Michael Overmeyer Date: Mon, 27 Jul 2026 18:07:12 -0400 Subject: [PATCH 6/8] Correct `Gemspec/DevelopmentDependencies` offences --- ruby-cldr.gemspec | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ruby-cldr.gemspec b/ruby-cldr.gemspec index 7494b63..8346015 100644 --- a/ruby-cldr.gemspec +++ b/ruby-cldr.gemspec @@ -147,10 +147,4 @@ Gem::Specification.new do |s| s.add_dependency("psych", [">= 4.0.0"]) s.add_dependency("rubyzip", [">= 0"]) s.add_dependency("thor", [">= 1.3.0"]) - s.add_development_dependency("jeweler", [">= 0"]) - s.add_development_dependency("pry", [">= 0"]) - s.add_development_dependency("pry-nav", [">= 0"]) - s.add_development_dependency("rubocop-shopify", [">= 0"]) - s.add_development_dependency("ruby-lsp", [">= 0"]) - s.add_development_dependency("test-unit", [">= 0"]) end From 1724ec945d25e950aa12b7949213212dcacb2d36 Mon Sep 17 00:00:00 2001 From: Michael Overmeyer Date: Mon, 27 Jul 2026 18:10:40 -0400 Subject: [PATCH 7/8] Drop Ruby 3.2 support --- .github/workflows/test.yml | 2 +- .rubocop.yml | 2 +- README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 88c8f9e..29d4768 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: ["3.2", "3.3", "3.4"] + ruby-version: ["3.3", "3.4"] cldr-version: [41] steps: diff --git a/.rubocop.yml b/.rubocop.yml index a73b817..4cb90ce 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -5,7 +5,7 @@ inherit_gem: rubocop-shopify: rubocop.yml AllCops: - TargetRubyVersion: 3.2 + TargetRubyVersion: 3.3 UseCache: true CacheRootDirectory: tmp/rubocop NewCops: enable diff --git a/README.md b/README.md index ec7de40..3a6679b 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ There are still a number of issues that need to be addressed before it can be co ## Requirements - * Ruby 3.2+ + * Ruby 3.3+ * [Thor](http://whatisthor.com/) ## Installation From cd69921e67fc4aa79579a16f6ffe9a4e82c066cc Mon Sep 17 00:00:00 2001 From: Michael Overmeyer Date: Mon, 27 Jul 2026 18:11:24 -0400 Subject: [PATCH 8/8] Test against Ruby 4.0 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 29d4768..fb6f22b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: ["3.3", "3.4"] + ruby-version: ["3.3", "3.4", "4.0"] cldr-version: [41] steps: