chinese_number 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chinese_number/parser.rb +13 -3
- data/lib/chinese_number/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b07a194edcdae7fbaba6135311a7b15cdd0efe9
|
4
|
+
data.tar.gz: 03295ee4692e9cb11ce144fec33c5e2b848bc305
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4a43fefd36e4bd970ce9918bff882aefe873e96f22b5717b95c0f8eeb7a6bf3f59777e948c6c478f2dd0979d2924edf96cdfb303c269dacaf982efdd8102a9b
|
7
|
+
data.tar.gz: 5efbf0030515e2e1401311686c4053404f6c65cd2c09a9ecee7da4eb6a1ec5c83593be2dc2b49f2cddd3008d9b9062c5fa01fcaa3b547bfa38ded2b14598e1cc
|
@@ -22,13 +22,23 @@ module ChineseNumber
|
|
22
22
|
'百' => 100,
|
23
23
|
'千' => 1000,
|
24
24
|
'万' => 10000,
|
25
|
-
|
26
|
-
|
25
|
+
|
26
|
+
# “兆” 在各处有不同的意义
|
27
|
+
# 可能是 “百万”、“万亿”或“万万亿”
|
28
|
+
# see:
|
29
|
+
# http://zh.wikipedia.org/wiki/%E5%85%86
|
30
|
+
#
|
31
|
+
# 你可以通过这样的方式修改成需要的含义:
|
32
|
+
#
|
33
|
+
# ChineseNumber::Parser::MULTIPERS['兆'] = 10000_0000_0000
|
34
|
+
'兆' => 100_0000,
|
35
|
+
|
36
|
+
'亿' => 10000_0000
|
27
37
|
}
|
28
38
|
end
|
29
39
|
|
30
40
|
DIGIT_MAP = generate_base_map.freeze
|
31
|
-
MULTIPERS = generate_multipers_map
|
41
|
+
MULTIPERS = generate_multipers_map
|
32
42
|
DIGIT_TOKEN = Regexp.new( "[#{DIGIT_MAP.keys.join}]" )
|
33
43
|
MULTIPER_TOKEN = Regexp.new( "[#{MULTIPERS.keys.join}]" )
|
34
44
|
TOKEN = Regexp.new( "[#{(DIGIT_MAP.keys + MULTIPERS.keys).join}]+" )
|