chinese_pinyin 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de7bacfdc8a6c8e7228ea6a4b5da14815392c9d2
4
- data.tar.gz: 772e43b327f6d946dfe4a47fe9b89c34964dd473
3
+ metadata.gz: 2dec1353e411c20fc6546a9157733afa6fbc86ad
4
+ data.tar.gz: 366cb811f7f80aabda938d9518b3a23326b4da0e
5
5
  SHA512:
6
- metadata.gz: e318fed6dd4e12986cafd5043f7087aca7f50ba4dd1982a35faeae844ebb83099b2f3bc9089637fee096dddc0037a9447e19804c8a03d87765ff85f8cfce686c
7
- data.tar.gz: d5d947373cd200349cdf3c508c83c6ccc18c91e3797c7029bd2e86402d0c1471f55676a24d4a2faed75cb83dcbe3000fd6569fc5cd3e46f0ac3e413e0944aa8f
6
+ metadata.gz: a91657ede038e57584b9b2419fd1beb764683a2e859ba81fb50781eced9ab416261ebb36d9bfabf1fbd2efbea98bf4b65b9c867f0176ff3cbeec4817d4e5f145
7
+ data.tar.gz: 2c162a64a704f120c98ba11efd8c156629ac4fb54e211273603645feeb985223556066faa8f4b2bf9da82de8480c3a716909098f3289fbc2a9c751b847bbd453
@@ -74,9 +74,13 @@ class Pinyin
74
74
 
75
75
  results << pinyin
76
76
  results << splitter
77
-
78
77
  else
79
- results << char
78
+ if char =~ /[a-zA-Z0-9]/
79
+ results << char
80
+ elsif results.last != splitter
81
+ results << splitter
82
+ else
83
+ end
80
84
  is_english = true
81
85
  end
82
86
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module ChinesePinyin
3
- VERSION = "0.6.0"
3
+ VERSION = "0.6.1"
4
4
  end
@@ -34,4 +34,8 @@ class PinyinTest < Test::Unit::TestCase
34
34
  assert_equal("Shang-Hai", Pinyin.t('上海', camelcase: true, splitter: '-'))
35
35
  assert_equal("Shang4-Hai3", Pinyin.t('上海', camelcase: true, tone:true, splitter: '-'))
36
36
  end
37
+
38
+ def test_t_with_chinese_punctuation
39
+ assert_equal("ce-shi-yi-xia-Think-diff", Pinyin.t('测试一下,Think diff', splitter: '-'))
40
+ end
37
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chinese_pinyin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-04 00:00:00.000000000 Z
12
+ date: 2013-12-01 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: translate chinese hanzi to pinyin.
15
15
  email:
@@ -53,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
53
  version: 1.3.6
54
54
  requirements: []
55
55
  rubyforge_project:
56
- rubygems_version: 2.0.5
56
+ rubygems_version: 2.1.11
57
57
  signing_key:
58
58
  specification_version: 4
59
59
  summary: translate chinese hanzi to pinyin.