icu4x 0.6.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/ext/icu4x/src/collator.rs +12 -1
- data/ext/icu4x/src/data_provider.rs +12 -2
- data/ext/icu4x/src/datetime_format.rs +25 -7
- data/ext/icu4x/src/display_names.rs +12 -1
- data/ext/icu4x/src/list_format.rs +12 -1
- data/ext/icu4x/src/number_format.rs +12 -1
- data/ext/icu4x/src/plural_rules.rs +12 -1
- data/ext/icu4x/src/relative_time_format.rs +12 -1
- data/ext/icu4x/src/segmenter.rs +12 -1
- data/lib/icu4x/version.rb +1 -1
- data/lib/icu4x/yard_docs.rb +1 -1
- metadata +7 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a6127d334332b2d38a6ef3518d9e7c076158d4eb21a282a982709dde0e8a9e70
|
|
4
|
+
data.tar.gz: 189fb0957980330e56c643bed174289039aa7f73f3d03d3ff91e8aab0211b6e4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 660d2834ff4811ff545c95c44e0e1ddecdfeda53b48e1cfdafd6c7ca12387a00c48c2836ae2eab58ebaf9f654386231eac0c0c2674633b2ab702a1b3ef3cd1f3
|
|
7
|
+
data.tar.gz: 87014b1b98c519d06f97b43a6697d344f94cc1ed4b055f4d4de13b269efefdb55d0d83628be2828adcbadbaebb419d4446e852dfa30c597d0c3478edab2b6560
|
data/CHANGELOG.md
CHANGED
data/ext/icu4x/src/collator.rs
CHANGED
|
@@ -46,7 +46,18 @@ pub struct Collator {
|
|
|
46
46
|
case_first: Option<CaseFirstOption>,
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
// SAFETY:
|
|
49
|
+
// SAFETY: This type is marked as Send to allow Ruby to move it between threads.
|
|
50
|
+
//
|
|
51
|
+
// Thread safety is guaranteed by Ruby's Global VM Lock (GVL):
|
|
52
|
+
// - All Ruby method calls are serialized by the GVL
|
|
53
|
+
// - Only one thread can execute Ruby code at a time
|
|
54
|
+
// - The underlying ICU4X types are only accessed through Ruby method calls
|
|
55
|
+
//
|
|
56
|
+
// WARNING: This safety guarantee does NOT hold if:
|
|
57
|
+
// - The GVL is released via `rb_thread_call_without_gvl`
|
|
58
|
+
// - Using threading libraries that bypass the GVL
|
|
59
|
+
//
|
|
60
|
+
// In such cases, concurrent access to this type would be unsafe.
|
|
50
61
|
unsafe impl Send for Collator {}
|
|
51
62
|
|
|
52
63
|
impl Collator {
|
|
@@ -25,8 +25,18 @@ pub struct DataProvider {
|
|
|
25
25
|
pub(crate) inner: LocaleFallbackProvider<BlobDataProvider>,
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
// SAFETY:
|
|
29
|
-
//
|
|
28
|
+
// SAFETY: This type is marked as Send to allow Ruby to move it between threads.
|
|
29
|
+
//
|
|
30
|
+
// Thread safety is guaranteed by Ruby's Global VM Lock (GVL):
|
|
31
|
+
// - All Ruby method calls are serialized by the GVL
|
|
32
|
+
// - Only one thread can execute Ruby code at a time
|
|
33
|
+
// - The underlying ICU4X types are only accessed through Ruby method calls
|
|
34
|
+
//
|
|
35
|
+
// WARNING: This safety guarantee does NOT hold if:
|
|
36
|
+
// - The GVL is released via `rb_thread_call_without_gvl`
|
|
37
|
+
// - Using threading libraries that bypass the GVL
|
|
38
|
+
//
|
|
39
|
+
// In such cases, concurrent access to this type would be unsafe.
|
|
30
40
|
unsafe impl Send for DataProvider {}
|
|
31
41
|
|
|
32
42
|
impl DataProvider {
|
|
@@ -106,7 +106,18 @@ pub struct DateTimeFormat {
|
|
|
106
106
|
calendar: Calendar,
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
// SAFETY:
|
|
109
|
+
// SAFETY: This type is marked as Send to allow Ruby to move it between threads.
|
|
110
|
+
//
|
|
111
|
+
// Thread safety is guaranteed by Ruby's Global VM Lock (GVL):
|
|
112
|
+
// - All Ruby method calls are serialized by the GVL
|
|
113
|
+
// - Only one thread can execute Ruby code at a time
|
|
114
|
+
// - The underlying ICU4X types are only accessed through Ruby method calls
|
|
115
|
+
//
|
|
116
|
+
// WARNING: This safety guarantee does NOT hold if:
|
|
117
|
+
// - The GVL is released via `rb_thread_call_without_gvl`
|
|
118
|
+
// - Using threading libraries that bypass the GVL
|
|
119
|
+
//
|
|
120
|
+
// In such cases, concurrent access to this type would be unsafe.
|
|
110
121
|
unsafe impl Send for DateTimeFormat {}
|
|
111
122
|
|
|
112
123
|
impl DateTimeFormat {
|
|
@@ -264,27 +275,34 @@ impl DateTimeFormat {
|
|
|
264
275
|
}
|
|
265
276
|
}
|
|
266
277
|
|
|
267
|
-
/// Format a Ruby Time object
|
|
278
|
+
/// Format a Ruby Time object or any object responding to #to_time
|
|
268
279
|
///
|
|
269
280
|
/// # Arguments
|
|
270
|
-
/// * `time` - A Ruby Time object
|
|
281
|
+
/// * `time` - A Ruby Time object or an object responding to #to_time (e.g., Date, DateTime)
|
|
271
282
|
///
|
|
272
283
|
/// # Returns
|
|
273
284
|
/// A formatted string
|
|
274
285
|
fn format(&self, time: Value) -> Result<String, Error> {
|
|
275
286
|
let ruby = Ruby::get().expect("Ruby runtime should be available");
|
|
276
287
|
|
|
277
|
-
//
|
|
288
|
+
// Convert to Time if the object responds to #to_time
|
|
289
|
+
let time_value = if time.respond_to("to_time", false)? {
|
|
290
|
+
time.funcall::<_, _, Value>("to_time", ())?
|
|
291
|
+
} else {
|
|
292
|
+
time
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
// Validate that the result is a Time object
|
|
278
296
|
let time_class: Value = ruby.eval("Time")?;
|
|
279
|
-
if !
|
|
297
|
+
if !time_value.is_kind_of(magnus::RClass::try_convert(time_class)?) {
|
|
280
298
|
return Err(Error::new(
|
|
281
299
|
ruby.exception_type_error(),
|
|
282
|
-
"argument must be a Time object",
|
|
300
|
+
"argument must be a Time object or respond to #to_time",
|
|
283
301
|
));
|
|
284
302
|
}
|
|
285
303
|
|
|
286
304
|
// Convert Ruby Time to ICU4X DateTime, applying timezone if specified
|
|
287
|
-
let datetime = self.convert_time_to_datetime(&ruby,
|
|
305
|
+
let datetime = self.convert_time_to_datetime(&ruby, time_value)?;
|
|
288
306
|
|
|
289
307
|
// Format the datetime
|
|
290
308
|
let formatted = self.inner.format(&datetime);
|
|
@@ -72,7 +72,18 @@ pub struct DisplayNames {
|
|
|
72
72
|
fallback: DisplayNamesFallback,
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
// SAFETY:
|
|
75
|
+
// SAFETY: This type is marked as Send to allow Ruby to move it between threads.
|
|
76
|
+
//
|
|
77
|
+
// Thread safety is guaranteed by Ruby's Global VM Lock (GVL):
|
|
78
|
+
// - All Ruby method calls are serialized by the GVL
|
|
79
|
+
// - Only one thread can execute Ruby code at a time
|
|
80
|
+
// - The underlying ICU4X types are only accessed through Ruby method calls
|
|
81
|
+
//
|
|
82
|
+
// WARNING: This safety guarantee does NOT hold if:
|
|
83
|
+
// - The GVL is released via `rb_thread_call_without_gvl`
|
|
84
|
+
// - Using threading libraries that bypass the GVL
|
|
85
|
+
//
|
|
86
|
+
// In such cases, concurrent access to this type would be unsafe.
|
|
76
87
|
unsafe impl Send for DisplayNames {}
|
|
77
88
|
|
|
78
89
|
impl DisplayNames {
|
|
@@ -43,7 +43,18 @@ pub struct ListFormat {
|
|
|
43
43
|
list_style: ListStyle,
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
// SAFETY:
|
|
46
|
+
// SAFETY: This type is marked as Send to allow Ruby to move it between threads.
|
|
47
|
+
//
|
|
48
|
+
// Thread safety is guaranteed by Ruby's Global VM Lock (GVL):
|
|
49
|
+
// - All Ruby method calls are serialized by the GVL
|
|
50
|
+
// - Only one thread can execute Ruby code at a time
|
|
51
|
+
// - The underlying ICU4X types are only accessed through Ruby method calls
|
|
52
|
+
//
|
|
53
|
+
// WARNING: This safety guarantee does NOT hold if:
|
|
54
|
+
// - The GVL is released via `rb_thread_call_without_gvl`
|
|
55
|
+
// - Using threading libraries that bypass the GVL
|
|
56
|
+
//
|
|
57
|
+
// In such cases, concurrent access to this type would be unsafe.
|
|
47
58
|
unsafe impl Send for ListFormat {}
|
|
48
59
|
|
|
49
60
|
impl ListFormat {
|
|
@@ -83,7 +83,18 @@ pub struct NumberFormat {
|
|
|
83
83
|
rounding_mode: RoundingMode,
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
// SAFETY:
|
|
86
|
+
// SAFETY: This type is marked as Send to allow Ruby to move it between threads.
|
|
87
|
+
//
|
|
88
|
+
// Thread safety is guaranteed by Ruby's Global VM Lock (GVL):
|
|
89
|
+
// - All Ruby method calls are serialized by the GVL
|
|
90
|
+
// - Only one thread can execute Ruby code at a time
|
|
91
|
+
// - The underlying ICU4X types are only accessed through Ruby method calls
|
|
92
|
+
//
|
|
93
|
+
// WARNING: This safety guarantee does NOT hold if:
|
|
94
|
+
// - The GVL is released via `rb_thread_call_without_gvl`
|
|
95
|
+
// - Using threading libraries that bypass the GVL
|
|
96
|
+
//
|
|
97
|
+
// In such cases, concurrent access to this type would be unsafe.
|
|
87
98
|
unsafe impl Send for NumberFormat {}
|
|
88
99
|
|
|
89
100
|
impl NumberFormat {
|
|
@@ -17,7 +17,18 @@ pub struct PluralRules {
|
|
|
17
17
|
rule_type: PluralRuleType,
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
// SAFETY:
|
|
20
|
+
// SAFETY: This type is marked as Send to allow Ruby to move it between threads.
|
|
21
|
+
//
|
|
22
|
+
// Thread safety is guaranteed by Ruby's Global VM Lock (GVL):
|
|
23
|
+
// - All Ruby method calls are serialized by the GVL
|
|
24
|
+
// - Only one thread can execute Ruby code at a time
|
|
25
|
+
// - The underlying ICU4X types are only accessed through Ruby method calls
|
|
26
|
+
//
|
|
27
|
+
// WARNING: This safety guarantee does NOT hold if:
|
|
28
|
+
// - The GVL is released via `rb_thread_call_without_gvl`
|
|
29
|
+
// - Using threading libraries that bypass the GVL
|
|
30
|
+
//
|
|
31
|
+
// In such cases, concurrent access to this type would be unsafe.
|
|
21
32
|
unsafe impl Send for PluralRules {}
|
|
22
33
|
|
|
23
34
|
impl PluralRules {
|
|
@@ -75,7 +75,18 @@ pub struct RelativeTimeFormat {
|
|
|
75
75
|
numeric: NumericMode,
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
// SAFETY:
|
|
78
|
+
// SAFETY: This type is marked as Send to allow Ruby to move it between threads.
|
|
79
|
+
//
|
|
80
|
+
// Thread safety is guaranteed by Ruby's Global VM Lock (GVL):
|
|
81
|
+
// - All Ruby method calls are serialized by the GVL
|
|
82
|
+
// - Only one thread can execute Ruby code at a time
|
|
83
|
+
// - The underlying ICU4X types are only accessed through Ruby method calls
|
|
84
|
+
//
|
|
85
|
+
// WARNING: This safety guarantee does NOT hold if:
|
|
86
|
+
// - The GVL is released via `rb_thread_call_without_gvl`
|
|
87
|
+
// - Using threading libraries that bypass the GVL
|
|
88
|
+
//
|
|
89
|
+
// In such cases, concurrent access to this type would be unsafe.
|
|
79
90
|
unsafe impl Send for RelativeTimeFormat {}
|
|
80
91
|
|
|
81
92
|
impl RelativeTimeFormat {
|
data/ext/icu4x/src/segmenter.rs
CHANGED
|
@@ -38,7 +38,18 @@ pub struct Segmenter {
|
|
|
38
38
|
granularity: Granularity,
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
// SAFETY:
|
|
41
|
+
// SAFETY: This type is marked as Send to allow Ruby to move it between threads.
|
|
42
|
+
//
|
|
43
|
+
// Thread safety is guaranteed by Ruby's Global VM Lock (GVL):
|
|
44
|
+
// - All Ruby method calls are serialized by the GVL
|
|
45
|
+
// - Only one thread can execute Ruby code at a time
|
|
46
|
+
// - The underlying ICU4X types are only accessed through Ruby method calls
|
|
47
|
+
//
|
|
48
|
+
// WARNING: This safety guarantee does NOT hold if:
|
|
49
|
+
// - The GVL is released via `rb_thread_call_without_gvl`
|
|
50
|
+
// - Using threading libraries that bypass the GVL
|
|
51
|
+
//
|
|
52
|
+
// In such cases, concurrent access to this type would be unsafe.
|
|
42
53
|
unsafe impl Send for Segmenter {}
|
|
43
54
|
|
|
44
55
|
impl Segmenter {
|
data/lib/icu4x/version.rb
CHANGED
data/lib/icu4x/yard_docs.rb
CHANGED
|
@@ -441,7 +441,7 @@
|
|
|
441
441
|
#
|
|
442
442
|
# # Formats a time value according to the configured options.
|
|
443
443
|
# #
|
|
444
|
-
# # @param time [Time] the time to format
|
|
444
|
+
# # @param time [Time, #to_time] the time to format (or any object responding to #to_time)
|
|
445
445
|
# # @return [String] the formatted date/time string
|
|
446
446
|
# #
|
|
447
447
|
# def format(time); end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: icu4x
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OZAWA Sakuro
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-01-
|
|
11
|
+
date: 2026-01-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: dry-configurable
|
|
@@ -38,7 +38,10 @@ dependencies:
|
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '0.9'
|
|
41
|
-
description:
|
|
41
|
+
description: |-
|
|
42
|
+
ICU4X provides Ruby bindings for the ICU4X library, offering Unicode
|
|
43
|
+
internationalization support including locale handling, number formatting,
|
|
44
|
+
date/time formatting, collation, segmentation, and more.
|
|
42
45
|
email:
|
|
43
46
|
- 10973+sakuro@users.noreply.github.com
|
|
44
47
|
executables: []
|
|
@@ -100,5 +103,5 @@ requirements: []
|
|
|
100
103
|
rubygems_version: 3.4.19
|
|
101
104
|
signing_key:
|
|
102
105
|
specification_version: 4
|
|
103
|
-
summary:
|
|
106
|
+
summary: Ruby bindings for ICU4X Unicode internationalization library
|
|
104
107
|
test_files: []
|