ffi-icu 0.1.10 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -4
- data/README.md +5 -7
- data/ffi-icu.gemspec +3 -2
- data/lib/ffi-icu/locale.rb +4 -4
- data/lib/ffi-icu/time_formatting.rb +1 -0
- data/lib/ffi-icu/version.rb +1 -1
- data/spec/locale_spec.rb +14 -1
- metadata +25 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a7c36403ec9b6c70045c537a2f31cc9fc62f065
|
4
|
+
data.tar.gz: dce1b25080ad24cd6325a4d4b50e81b7938fc4f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01a065f767fba3fcc658838d2891782538f244246c912c9f483f440b896d7e52620128097b00bbe92f1edf6e0a26a205010ac6b02b3c15923d37903c613ff5f5
|
7
|
+
data.tar.gz: 941fd743b77fbbabd24254f3f23f0d18093c7614877b0a50d532211cae728f3173b2f7d744943e7e6364950ecc9f12a0770fddda150732d0a96c85880053df56
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
ffi-icu
|
2
2
|
=======
|
3
3
|
|
4
|
-
Simple FFI wrappers for
|
5
|
-
|
6
|
-
[![Build Status](https://secure.travis-ci.org/jarib/ffi-icu.png)](http://travis-ci.org/jarib/ffi-icu)
|
4
|
+
Simple FFI wrappers for ICU. Checkout the renovated [ICU gem](https://github.com/fantasticfears/icu4r) instead which supports various of encoding and distributed with packaged source. FFI-ICU needs some love with ICU gem's transcoding method.
|
7
5
|
|
8
6
|
Gem
|
9
7
|
---
|
@@ -132,10 +130,10 @@ Platforms:
|
|
132
130
|
|
133
131
|
Rubies:
|
134
132
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
133
|
+
- 2.4.6
|
134
|
+
- 2.5.5
|
135
|
+
- 2.6.3
|
136
|
+
- ruby-head
|
139
137
|
|
140
138
|
TODO:
|
141
139
|
=====
|
data/ffi-icu.gemspec
CHANGED
@@ -6,7 +6,8 @@ Gem::Specification.new do |s|
|
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Jari Bakken"]
|
9
|
-
s.date = %q{
|
9
|
+
s.date = %q{2019-10-15}
|
10
|
+
s.licenses = ['MIT']
|
10
11
|
s.description = %q{Provides charset detection, locale sensitive collation and more. Depends on libicu.}
|
11
12
|
s.email = %q{jari.bakken@gmail.com}
|
12
13
|
s.extra_rdoc_files = ["LICENSE", "README.md"]
|
@@ -20,7 +21,7 @@ Gem::Specification.new do |s|
|
|
20
21
|
s.summary = %q{Simple Ruby FFI wrappers for things I need from ICU.}
|
21
22
|
|
22
23
|
s.add_runtime_dependency "ffi", "~> 1.0", ">= 1.0.9"
|
23
|
-
s.add_development_dependency
|
24
|
+
s.add_development_dependency 'rspec', '~> 2.5', '>= 2.5.0'
|
24
25
|
s.add_development_dependency "rake", ["~> 0.9.2"]
|
25
26
|
end
|
26
27
|
|
data/lib/ffi-icu/locale.rb
CHANGED
@@ -75,7 +75,7 @@ module ICU
|
|
75
75
|
def display_country(locale = nil)
|
76
76
|
locale = locale.to_s unless locale.nil?
|
77
77
|
|
78
|
-
Lib::Util.read_uchar_buffer(
|
78
|
+
Lib::Util.read_uchar_buffer(256) do |buffer, status|
|
79
79
|
Lib.uloc_getDisplayCountry(@id, locale, buffer, buffer.size, status)
|
80
80
|
end
|
81
81
|
end
|
@@ -83,7 +83,7 @@ module ICU
|
|
83
83
|
def display_language(locale = nil)
|
84
84
|
locale = locale.to_s unless locale.nil?
|
85
85
|
|
86
|
-
Lib::Util.read_uchar_buffer(
|
86
|
+
Lib::Util.read_uchar_buffer(192) do |buffer, status|
|
87
87
|
Lib.uloc_getDisplayLanguage(@id, locale, buffer, buffer.size, status)
|
88
88
|
end
|
89
89
|
end
|
@@ -91,7 +91,7 @@ module ICU
|
|
91
91
|
def display_name(locale = nil)
|
92
92
|
locale = locale.to_s unless locale.nil?
|
93
93
|
|
94
|
-
Lib::Util.read_uchar_buffer(
|
94
|
+
Lib::Util.read_uchar_buffer(256) do |buffer, status|
|
95
95
|
Lib.uloc_getDisplayName(@id, locale, buffer, buffer.size, status)
|
96
96
|
end
|
97
97
|
end
|
@@ -99,7 +99,7 @@ module ICU
|
|
99
99
|
def display_script(locale = nil)
|
100
100
|
locale = locale.to_s unless locale.nil?
|
101
101
|
|
102
|
-
Lib::Util.read_uchar_buffer(
|
102
|
+
Lib::Util.read_uchar_buffer(128) do |buffer, status|
|
103
103
|
Lib.uloc_getDisplayScript(@id, locale, buffer, buffer.size, status)
|
104
104
|
end
|
105
105
|
end
|
data/lib/ffi-icu/version.rb
CHANGED
data/spec/locale_spec.rb
CHANGED
@@ -93,6 +93,8 @@ module ICU
|
|
93
93
|
end
|
94
94
|
|
95
95
|
describe 'display' do
|
96
|
+
let(:locale_ids) { Locale.available.map(&:id) }
|
97
|
+
|
96
98
|
context 'in a specific locale' do
|
97
99
|
it 'returns the country' do
|
98
100
|
Locale.new('de_DE').display_country('en').should == 'Germany'
|
@@ -111,13 +113,24 @@ module ICU
|
|
111
113
|
|
112
114
|
it 'returns the script' do
|
113
115
|
Locale.new('ja_Hira_JP').display_script('en').should == 'Hiragana'
|
114
|
-
Locale.new('ja_Hira_JP').display_script('ru').should == '
|
116
|
+
Locale.new('ja_Hira_JP').display_script('ru').should == 'хирагана'
|
115
117
|
end
|
116
118
|
|
117
119
|
it 'returns the variant' do
|
118
120
|
Locale.new('be_BY_TARASK').display_variant('de').should == 'Taraskievica-Orthographie'
|
119
121
|
Locale.new('zh_CH_POSIX').display_variant('en').should == 'Computer'
|
120
122
|
end
|
123
|
+
|
124
|
+
# If memory set for 'read_uchar_buffer' is set too low it will throw an out
|
125
|
+
# of bounds memory error, which results in a Segmentation fault error.
|
126
|
+
it 'insures memory sizes is set correctly' do
|
127
|
+
# Currently, testing the longest known locales. May need to be update in the future.
|
128
|
+
Locale.new('en_VI').display_country('ccp').should_not be_nil
|
129
|
+
Locale.new('yue_Hant').display_language('ccp').should_not be_nil
|
130
|
+
Locale.new('en_VI').display_name('ccp').should_not be_nil
|
131
|
+
Locale.new('yue_Hant').display_script('ccp').should_not be_nil
|
132
|
+
Locale.new('en_US_POSIX').display_variant('sl').should_not be_nil
|
133
|
+
end
|
121
134
|
end
|
122
135
|
|
123
136
|
context 'in the default locale' do
|
metadata
CHANGED
@@ -1,61 +1,67 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi-icu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jari Bakken
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.0'
|
20
|
-
- -
|
20
|
+
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 1.0.9
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - ~>
|
27
|
+
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '1.0'
|
30
|
-
- -
|
30
|
+
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 1.0.9
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rspec
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - ~>
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '2.5'
|
40
|
+
- - ">="
|
38
41
|
- !ruby/object:Gem::Version
|
39
42
|
version: 2.5.0
|
40
43
|
type: :development
|
41
44
|
prerelease: false
|
42
45
|
version_requirements: !ruby/object:Gem::Requirement
|
43
46
|
requirements:
|
44
|
-
- - ~>
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '2.5'
|
50
|
+
- - ">="
|
45
51
|
- !ruby/object:Gem::Version
|
46
52
|
version: 2.5.0
|
47
53
|
- !ruby/object:Gem::Dependency
|
48
54
|
name: rake
|
49
55
|
requirement: !ruby/object:Gem::Requirement
|
50
56
|
requirements:
|
51
|
-
- - ~>
|
57
|
+
- - "~>"
|
52
58
|
- !ruby/object:Gem::Version
|
53
59
|
version: 0.9.2
|
54
60
|
type: :development
|
55
61
|
prerelease: false
|
56
62
|
version_requirements: !ruby/object:Gem::Requirement
|
57
63
|
requirements:
|
58
|
-
- - ~>
|
64
|
+
- - "~>"
|
59
65
|
- !ruby/object:Gem::Version
|
60
66
|
version: 0.9.2
|
61
67
|
description: Provides charset detection, locale sensitive collation and more. Depends
|
@@ -67,9 +73,9 @@ extra_rdoc_files:
|
|
67
73
|
- LICENSE
|
68
74
|
- README.md
|
69
75
|
files:
|
70
|
-
- .document
|
71
|
-
- .gitignore
|
72
|
-
- .travis.yml
|
76
|
+
- ".document"
|
77
|
+
- ".gitignore"
|
78
|
+
- ".travis.yml"
|
73
79
|
- Gemfile
|
74
80
|
- LICENSE
|
75
81
|
- README.md
|
@@ -108,26 +114,27 @@ files:
|
|
108
114
|
- spec/uchar_spec.rb
|
109
115
|
- test.c
|
110
116
|
homepage: http://github.com/jarib/ffi-icu
|
111
|
-
licenses:
|
117
|
+
licenses:
|
118
|
+
- MIT
|
112
119
|
metadata: {}
|
113
120
|
post_install_message:
|
114
121
|
rdoc_options:
|
115
|
-
- --charset=UTF-8
|
122
|
+
- "--charset=UTF-8"
|
116
123
|
require_paths:
|
117
124
|
- lib
|
118
125
|
required_ruby_version: !ruby/object:Gem::Requirement
|
119
126
|
requirements:
|
120
|
-
- -
|
127
|
+
- - ">="
|
121
128
|
- !ruby/object:Gem::Version
|
122
129
|
version: '0'
|
123
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
131
|
requirements:
|
125
|
-
- -
|
132
|
+
- - ">="
|
126
133
|
- !ruby/object:Gem::Version
|
127
134
|
version: '0'
|
128
135
|
requirements: []
|
129
136
|
rubyforge_project:
|
130
|
-
rubygems_version: 2.
|
137
|
+
rubygems_version: 2.5.2.3
|
131
138
|
signing_key:
|
132
139
|
specification_version: 4
|
133
140
|
summary: Simple Ruby FFI wrappers for things I need from ICU.
|