digit_delim 0.0.2 → 0.1.0

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: 4b88f14aaa23708b6d5871ddb0091dd254c2a8f8
4
- data.tar.gz: 176900dcc5f5fb58536a68995a4d31ad6a9a012d
3
+ metadata.gz: 499bd98b3a7f8d5ecfe21007c4aeb977a3bbd5eb
4
+ data.tar.gz: 2cb6119fe67c908c10f739ef907e0959fac6d037
5
5
  SHA512:
6
- metadata.gz: a37abc2c0762fb0971fb90d6493e2df862b24972e5dba747bfb26d45ffe07a9b19ca02ebcd93d40273b1bcfa5abc838ad3515cabfa608f8b2baa42df5bbcfaa5
7
- data.tar.gz: 3dfede9e812655f7485256d3c0723651aec96759ef9ffe92ab4ebcbdbaa7684c93d444e965bfe77b2fa5393fb1ccb16443b715c4aaff17cb60ece0eab9e8d64f
6
+ metadata.gz: 663574b84a12f6293f6c4278f2173f74bc3dfa401455789c00393019d945fb38dec53b0af41e57ba10ed6dc431a170e711ce477dd813ba2b833b7a9e3346b30d
7
+ data.tar.gz: 7f47fa71920b86271dfe5e1d97ada2228b2bf31fde8440d09bc31e96afb0343c7475170e58f2a182743af8318d9f2203090946bad35ccbefc47a2960b95ceea8
data/Gemfile CHANGED
@@ -6,9 +6,12 @@ source "http://rubygems.org"
6
6
  # Add dependencies to develop your gem here.
7
7
  # Include everything needed to run rake, tests, features, etc.
8
8
  group :development do
9
- gem "shoulda", ">= 0"
10
- gem "rdoc", "~> 3.12"
11
- gem "bundler", "~> 1.3.5"
12
- gem "jeweler", "~> 1.8.4"
13
- gem "simplecov-rcov", ">= 0"
9
+ # gem "shoulda", ">= 0"
10
+ # gem "rdoc", "~> 3.12"
11
+ # gem "bundler", "~> 1.3.5"
12
+ gem "bundler", ">= 1.3.5"
13
+ # gem "jeweler", "~> 1.8.4"
14
+ gem "jeweler", ">= 1.8.4"
15
+ # gem "simplecov-rcov", ">= 0"
16
+ gem "test-unit", ">= 3.1.5"
14
17
  end
data/Gemfile.lock CHANGED
@@ -1,79 +1,62 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- activesupport (4.0.0)
5
- i18n (~> 0.6, >= 0.6.4)
6
- minitest (~> 4.2)
7
- multi_json (~> 1.3)
8
- thread_safe (~> 0.1)
9
- tzinfo (~> 0.3.37)
10
- addressable (2.3.5)
11
- atomic (1.1.10)
4
+ addressable (2.4.0)
12
5
  builder (3.2.2)
6
+ descendants_tracker (0.0.4)
7
+ thread_safe (~> 0.3, >= 0.3.1)
13
8
  faraday (0.8.8)
14
9
  multipart-post (~> 1.2.0)
15
10
  git (1.2.5)
16
- github_api (0.10.1)
17
- addressable
18
- faraday (~> 0.8.1)
19
- hashie (>= 1.2)
20
- multi_json (~> 1.4)
21
- nokogiri (~> 1.5.2)
22
- oauth2
23
- hashie (2.0.5)
11
+ github_api (0.14.4)
12
+ addressable (~> 2.4.0)
13
+ descendants_tracker (~> 0.0.4)
14
+ faraday (~> 0.8, < 0.10)
15
+ hashie (>= 3.4)
16
+ oauth2 (~> 1.0.0)
17
+ hashie (3.4.4)
24
18
  highline (1.6.19)
25
- httpauth (0.2.0)
26
- i18n (0.6.4)
27
- jeweler (1.8.6)
19
+ jeweler (2.1.1)
28
20
  builder
29
- bundler (~> 1.0)
21
+ bundler (>= 1.0)
30
22
  git (>= 1.2.5)
31
- github_api (= 0.10.1)
23
+ github_api
32
24
  highline (>= 1.6.15)
33
- nokogiri (= 1.5.10)
25
+ nokogiri (>= 1.5.10)
34
26
  rake
35
27
  rdoc
36
- json (1.8.0)
37
- jwt (0.1.8)
38
- multi_json (>= 1.5)
39
- minitest (4.7.5)
28
+ semver
29
+ jwt (1.5.4)
30
+ mini_portile2 (2.1.0)
40
31
  multi_json (1.7.7)
41
32
  multi_xml (0.5.4)
42
33
  multipart-post (1.2.0)
43
- nokogiri (1.5.10)
44
- oauth2 (0.9.2)
45
- faraday (~> 0.8)
46
- httpauth (~> 0.2)
47
- jwt (~> 0.1.4)
48
- multi_json (~> 1.0)
34
+ nokogiri (1.6.8)
35
+ mini_portile2 (~> 2.1.0)
36
+ pkg-config (~> 1.1.7)
37
+ oauth2 (1.0.0)
38
+ faraday (>= 0.8, < 0.10)
39
+ jwt (~> 1.0)
40
+ multi_json (~> 1.3)
49
41
  multi_xml (~> 0.5)
50
42
  rack (~> 1.2)
43
+ pkg-config (1.1.7)
44
+ power_assert (0.2.6)
51
45
  rack (1.5.2)
52
- rake (10.1.0)
53
- rdoc (3.12.2)
54
- json (~> 1.4)
55
- shoulda (3.5.0)
56
- shoulda-context (~> 1.0, >= 1.0.1)
57
- shoulda-matchers (>= 1.4.1, < 3.0)
58
- shoulda-context (1.1.4)
59
- shoulda-matchers (2.2.0)
60
- activesupport (>= 3.0.0)
61
- simplecov (0.7.1)
62
- multi_json (~> 1.0)
63
- simplecov-html (~> 0.7.1)
64
- simplecov-html (0.7.1)
65
- simplecov-rcov (0.2.3)
66
- simplecov (>= 0.4.1)
67
- thread_safe (0.1.2)
68
- atomic
69
- tzinfo (0.3.37)
46
+ rake (11.2.2)
47
+ rdoc (4.2.1)
48
+ semver (1.0.1)
49
+ test-unit (3.1.5)
50
+ power_assert
51
+ thread_safe (0.3.5)
70
52
 
71
53
  PLATFORMS
72
54
  ruby
73
55
 
74
56
  DEPENDENCIES
75
- bundler (~> 1.3.5)
76
- jeweler (~> 1.8.4)
77
- rdoc (~> 3.12)
78
- shoulda
79
- simplecov-rcov
57
+ bundler (>= 1.3.5)
58
+ jeweler (>= 1.8.4)
59
+ test-unit (>= 3.1.5)
60
+
61
+ BUNDLED WITH
62
+ 1.12.5
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 YAMAMOTO, Masayuki
1
+ Copyright (c) 2013- YAMAMOTO, Masayuki
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/ReadMe.md CHANGED
@@ -3,6 +3,7 @@
3
3
  ## Description
4
4
 
5
5
  provides the methods to separate a number with the delimiter for each 3 digits.
6
+ * 漢数字を含む文字列を実際の数値に変換する `KanNum.str_to_num` (`String#str_to_num`) を追加
6
7
 
7
8
  ## Installation
8
9
 
@@ -15,9 +16,11 @@ provides the methods to separate a number with the delimiter for each 3 digits.
15
16
  See the test code.
16
17
 
17
18
  ## Lisence
19
+
18
20
  MIT Lisence.
19
21
 
20
22
  ## About the Author
23
+
21
24
  YAMAMOTO, Masayuki
22
25
 
23
26
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.1.0
data/digit_delim.gemspec CHANGED
@@ -2,14 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
+ # stub: digit_delim 0.1.0 ruby lib
5
6
 
6
7
  Gem::Specification.new do |s|
7
8
  s.name = "digit_delim"
8
- s.version = "0.0.1"
9
+ s.version = "0.1.0"
9
10
 
10
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
11
13
  s.authors = ["YAMAMOTO, Masayuki"]
12
- s.date = "2013-07-30"
14
+ s.date = "2016-07-28"
13
15
  s.description = "methods of num-string formatter, converter which extends String class"
14
16
  s.email = "martin.route66.blues+github@gmail.com"
15
17
  s.extra_rdoc_files = [
@@ -25,37 +27,32 @@ Gem::Specification.new do |s|
25
27
  "VERSION",
26
28
  "digit_delim.gemspec",
27
29
  "lib/digit_delim.rb",
30
+ "lib/kannum.rb",
28
31
  "test/helper.rb",
29
- "test/test_digit_delim.rb"
32
+ "test/test_digit_delim.rb",
33
+ "test/test_kannum.rb"
30
34
  ]
31
35
  s.homepage = "http://github.com/mephistobooks/digit_delim"
32
36
  s.licenses = ["MIT"]
33
- s.require_paths = ["lib"]
34
- s.rubygems_version = "2.0.3"
37
+ s.rubygems_version = "2.5.1"
35
38
  s.summary = "A little num-string formatter, converter."
36
39
 
37
40
  if s.respond_to? :specification_version then
38
41
  s.specification_version = 4
39
42
 
40
43
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
41
- s.add_development_dependency(%q<shoulda>, [">= 0"])
42
- s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
43
- s.add_development_dependency(%q<bundler>, ["~> 1.3.5"])
44
- s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
45
- s.add_development_dependency(%q<simplecov-rcov>, [">= 0"])
44
+ s.add_development_dependency(%q<bundler>, [">= 1.3.5"])
45
+ s.add_development_dependency(%q<jeweler>, [">= 1.8.4"])
46
+ s.add_development_dependency(%q<test-unit>, [">= 3.1.5"])
46
47
  else
47
- s.add_dependency(%q<shoulda>, [">= 0"])
48
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
49
- s.add_dependency(%q<bundler>, ["~> 1.3.5"])
50
- s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
51
- s.add_dependency(%q<simplecov-rcov>, [">= 0"])
48
+ s.add_dependency(%q<bundler>, [">= 1.3.5"])
49
+ s.add_dependency(%q<jeweler>, [">= 1.8.4"])
50
+ s.add_dependency(%q<test-unit>, [">= 3.1.5"])
52
51
  end
53
52
  else
54
- s.add_dependency(%q<shoulda>, [">= 0"])
55
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
56
- s.add_dependency(%q<bundler>, ["~> 1.3.5"])
57
- s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
58
- s.add_dependency(%q<simplecov-rcov>, [">= 0"])
53
+ s.add_dependency(%q<bundler>, [">= 1.3.5"])
54
+ s.add_dependency(%q<jeweler>, [">= 1.8.4"])
55
+ s.add_dependency(%q<test-unit>, [">= 3.1.5"])
59
56
  end
60
57
  end
61
58
 
data/lib/digit_delim.rb CHANGED
@@ -75,5 +75,6 @@ class String
75
75
  end
76
76
 
77
77
 
78
+ require "kannum"
78
79
 
79
80
  #### endof filename: digit_delim.rb
data/lib/kannum.rb ADDED
@@ -0,0 +1,217 @@
1
+ #
2
+ #
3
+ #
4
+ #
5
+
6
+
7
+ module KanNum
8
+ N_数 = {
9
+ '〇'=>0,
10
+ '一'=>1, '壱'=>1,
11
+ '二'=>2, '弐'=>2,
12
+ '三'=>3, '参'=>3,
13
+ '四'=>4,
14
+ '五'=>5,
15
+ '六'=>6,
16
+ '七'=>7,
17
+ '八'=>8,
18
+ '九'=>9,
19
+
20
+ '0'=>0,
21
+ '1'=>1,
22
+ '2'=>2,
23
+ '3'=>3,
24
+ '4'=>4,
25
+ '5'=>5,
26
+ '6'=>6,
27
+ '7'=>7,
28
+ '8'=>8,
29
+ '9'=>9,
30
+ }
31
+
32
+ N_数_ext = {
33
+ '零'=>0,
34
+ '肆'=>4,
35
+ '伍'=>5,
36
+ '陸'=>6,
37
+ '漆'=>7, '質'=>7,
38
+ '捌'=>8,
39
+ '玖'=>9,
40
+ }
41
+
42
+ N_倍数 = {
43
+ '十' => 10**1, '拾' => 10**1,
44
+ '百' => 10**2,
45
+ '千' => 10**3,
46
+ }
47
+
48
+ N_倍数_ext = {
49
+ '阡' => 10**3,
50
+ }
51
+
52
+ N_合成倍数 = {
53
+ '廿' => 2*10,
54
+ '丗' => 3*10,
55
+ '卌' => 4*10,
56
+ }
57
+
58
+ N_単位数 = {
59
+ '万' => 10**4, '萬' => 10**4,
60
+ '億' => 10**8,
61
+ '兆' => 10**12,
62
+ '京' => 10**16,
63
+ '垓' => 10**20,
64
+ }
65
+
66
+ N_ary = [ N_数, N_倍数, N_単位数, ]
67
+ N_ary_loose = N_ary + [ N_数_ext, N_倍数_ext, N_合成倍数, ]
68
+
69
+ N_keys = N_ary.map{|e| e.keys}.inject(:+)
70
+ N_keys_loose = N_ary_loose.map{|e| e.keys}.inject(:+)
71
+
72
+ #
73
+ #
74
+ #
75
+ def self.numable?( str, dict = N_keys )
76
+ tmp_str = str.gsub(/[0-90-9]/,'')
77
+ # tmp = dict.map{|e| e.keys}.inject(:+)
78
+ tmp = dict
79
+ #tmp += (0..9).to_a
80
+
81
+ ret = true
82
+ (0..(tmp_str.size-1)).each {|i|
83
+ c = tmp_str[i]
84
+ if tmp.include?(c)
85
+ next
86
+ else
87
+ ret = false
88
+ break
89
+ end
90
+ }
91
+ ret
92
+ end
93
+ def self.numable_loose?( str )
94
+ numable?(str, N_keys_loose)
95
+ end
96
+
97
+
98
+ # simple chr-to-chr translation: 0-9.
99
+ #
100
+ #
101
+ def self.translate_phase0( str )
102
+ #str = str.tr("0-9", "0-9")
103
+
104
+ tmp_str = str
105
+ # str.split(//).each_with_index{|e,i|
106
+ (0..(str.length-1)).each{|i|
107
+ c = str[i]
108
+ tmp = N_数[c]
109
+ tmp_str[i] = tmp.to_s unless tmp.nil?
110
+ }
111
+
112
+ tmp_str
113
+ end
114
+
115
+ # create parse tree for str:
116
+ # [ [[ num, Num, ... ], UnitNum], ... ]
117
+ #
118
+ def self.translate_phase1( str )
119
+ ret = []
120
+ tmp_ary = []
121
+ units = N_単位数.keys
122
+
123
+ # $stderr.puts "#{__method__} str: #{str}"
124
+ # str.split(//).each do |c|
125
+ (0..(str.length-1)).each do |i|
126
+ c = str[i]
127
+
128
+ if units.include?(c)
129
+ tmp = tmp_ary.join
130
+ # $stderr.puts "#{__method__} tmp: #{tmp}"
131
+ tmp = tmp.gsub(/([0-9]+)([^ 0-9])/, '\1 \2')
132
+ # $stderr.puts "#{__method__} tmp: #{tmp}"
133
+ tmp = tmp.gsub(/([^ 0-9])([0-9]+)/, '\1 \2')
134
+
135
+ tmp = tmp.gsub(/([^ 0-9])([^ 0-9])/, '\1 \2')
136
+ # $stderr.puts "#{__method__} tmp: #{tmp}"
137
+ tmp = tmp.split(/\s+/)
138
+ # $stderr.puts "#{__method__} tmp: #{tmp}"
139
+ ret << [tmp, c]
140
+ tmp_ary = []
141
+ next
142
+ end
143
+ tmp_ary << c
144
+ # $stderr.puts "#{__method__} tmp_ary: #{tmp_ary}"
145
+ end
146
+ ret << tmp_ary if tmp_ary.size > 0
147
+
148
+ ret
149
+ end
150
+
151
+ # calculate number due to parse tree.
152
+ # ==== Args
153
+ # ary :: parse tree with _phase1
154
+ # ==== Return
155
+ # number
156
+ def self.translate_phase2( ary )
157
+ ret = 0
158
+ # $stderr.puts "{#{__method__}} ary: #{ary}"
159
+
160
+ #
161
+ ary.each do |ua|
162
+ na, u = ua
163
+ if na.class != Array
164
+ na = ua
165
+ u = '1'
166
+ end
167
+
168
+ tmp = 0
169
+ tmp_ary = []
170
+
171
+ na.each do |e|
172
+ tmp_ary << e
173
+ if e =~ /[0-9]+/
174
+ else
175
+ # $stderr.puts "#{__method__} tmp_ary: #{tmp_ary}"
176
+ a = 1
177
+ b = N_倍数[tmp_ary[-1]]
178
+ a = tmp_ary[0].to_i if tmp_ary.size > 1
179
+
180
+ tmp += a*b
181
+ tmp_ary = []
182
+ end
183
+ end
184
+ # $stderr.puts "#{__method__} tmp_ary: #{tmp_ary}"
185
+ tmp += tmp_ary[0].to_i if tmp_ary.size != 0
186
+
187
+ tmp_u = N_単位数[u]
188
+ if tmp_u.nil?
189
+ ret += tmp * 1
190
+ else
191
+ ret += tmp * tmp_u
192
+ end
193
+
194
+ end
195
+
196
+ ret
197
+ end
198
+
199
+ def self.str_to_num( str )
200
+
201
+ tmp = translate_phase0(str)
202
+ # $stderr.puts "result0: #{tmp}"
203
+ tmp = translate_phase1(tmp)
204
+ # $stderr.puts "result1: #{tmp}"
205
+ ret = translate_phase2(tmp)
206
+
207
+ ret
208
+ end
209
+
210
+ end
211
+
212
+ class String
213
+ def str_to_num; KanNum.str_to_num self; end
214
+ end
215
+
216
+
217
+ #### endof filename: .rb
data/test/helper.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'rubygems'
1
+ # require 'rubygems'
2
2
  require 'bundler'
3
3
  begin
4
4
  Bundler.setup(:default, :development)
@@ -8,7 +8,7 @@ rescue Bundler::BundlerError => e
8
8
  exit e.status_code
9
9
  end
10
10
  require 'test/unit'
11
- require 'shoulda'
11
+ #require 'shoulda'
12
12
 
13
13
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
14
  $LOAD_PATH.unshift(File.dirname(__FILE__))
@@ -17,6 +17,8 @@ class TestDigitDelim < Test::Unit::TestCase
17
17
 
18
18
  def test_w_dm_1
19
19
  assert_equal( "123", "123".w_dm )
20
+ assert_equal( "1,000", 1000.to_s.w_dm )
21
+
20
22
  assert_equal( "23,456,789", "23456789".w_dm )
21
23
  assert_equal( "23,456,789.0123", "23456789.0123".w_dm )
22
24
  assert_equal( "23,456,789.0123", "23456789.0123".w_dm(-1, 3) )
@@ -42,10 +44,20 @@ class TestDigitDelim < Test::Unit::TestCase
42
44
 
43
45
  assert_equal( "2345,6789.01", t_pat.to_s.w_dm(2, 4) )
44
46
  assert_equal( "2,3,4,5,6,7,8,9.01", t_pat.to_s.w_dm(2, 1) )
47
+
48
+ # with sign.
49
+ assert_equal( "+2,100", sprintf("%+d", 2_100).w_dm )
50
+ assert_equal( "-2,100", sprintf("%+d", -2_100).w_dm )
51
+
52
+ # with sign, in percentage (符号付き, パーセント表記)
53
+ assert_equal( "-10.10%", sprintf("%+.2f%", -0.1010*100).w_dm )
54
+ assert_equal( "+10.10%", sprintf("%+.2f%", +0.1010*100).w_dm )
55
+
45
56
  end
46
57
 
47
58
  def test_wo_dm
48
59
  assert_equal( "100000", "100,000".wo_dm )
60
+ assert_equal( "100000", "100,000".wo_dm.to_i.to_s )
49
61
  assert_equal( "100000.0123", "100,000.0123".wo_dm )
50
62
  end
51
63
 
@@ -59,6 +71,8 @@ class TestDigitDelim < Test::Unit::TestCase
59
71
  assert_not_equal( exp.to_s, "100,000".to_wof.to_s )
60
72
  assert_equal( exp.to_s + ".0", "100,000".to_wof.to_s )
61
73
 
74
+ #
75
+ assert_equal( 1791.11, "1,791.11".to_wof )
62
76
  end
63
77
 
64
78
  def test_to_wof_stocks
@@ -0,0 +1,102 @@
1
+ #
2
+ # filename: test_kannum.rb
3
+ # To do this test case, ``rake test``.
4
+ #
5
+ require "helper"
6
+ require 'test/unit'
7
+
8
+ # Testee.
9
+ require "digit_delim"
10
+
11
+
12
+ class TestKanNum < Test::Unit::TestCase
13
+
14
+ def setup
15
+
16
+ @pattern_t1 = "12億3456万"
17
+ @pattern_t2 = "100億"
18
+ @pattern_t21 = "百億"
19
+ @pattern_t22 = "100億"
20
+
21
+ @pattern_t3 = "2千億3千4百十万"
22
+ @pattern_t31 = "2千億3千十万"
23
+ @pattern_t32 = "2千億千十万"
24
+
25
+ @pattern_t4 = "千百3十万"
26
+ @pattern_t5 = "参拾"
27
+ @pattern_t51 = "参"
28
+ @pattern_t52 = "拾"
29
+
30
+ end
31
+
32
+ def tear
33
+ end
34
+
35
+ def test_basic
36
+
37
+ ret = "壱萬参千弐百".str_to_num
38
+ exp = 1_3200
39
+ assert_equal( exp, ret )
40
+
41
+ ret = @pattern_t1.str_to_num
42
+ exp = 12_3456_0000
43
+ assert_equal( exp, ret )
44
+
45
+ ret = KanNum.str_to_num @pattern_t2
46
+ exp = 100_0000_0000
47
+ assert_equal( exp, ret )
48
+
49
+ ret = KanNum.str_to_num @pattern_t21
50
+ exp = 100_0000_0000
51
+ assert_equal( exp, ret )
52
+
53
+ ret = KanNum.str_to_num @pattern_t22
54
+ exp = 100_0000_0000
55
+ assert_equal( exp, ret )
56
+
57
+ ret = KanNum.str_to_num @pattern_t3
58
+ exp = 2000_3410_0000
59
+ assert_equal( exp, ret )
60
+
61
+ ret = KanNum.str_to_num @pattern_t31
62
+ exp = 2000_3010_0000
63
+ assert_equal( exp, ret )
64
+
65
+ ret = KanNum.str_to_num @pattern_t32
66
+ exp = 2000_1010_0000
67
+ assert_equal( exp, ret )
68
+
69
+ ret = KanNum.str_to_num @pattern_t4
70
+ exp = 1130_0000
71
+ assert_equal( exp, ret )
72
+
73
+ ret = KanNum.str_to_num @pattern_t5
74
+ exp = 30
75
+ assert_equal( exp, ret )
76
+
77
+ ret = KanNum.str_to_num @pattern_t51
78
+ exp = 3
79
+ assert_equal( exp, ret )
80
+
81
+ ret = KanNum.str_to_num @pattern_t52
82
+ exp = 10
83
+ assert_equal( exp, ret )
84
+
85
+ end
86
+
87
+ def test_numable?
88
+
89
+ ret = KanNum.numable? @pattern_t1
90
+ exp = true
91
+ assert_equal( exp, ret )
92
+
93
+ ret = KanNum.numable? "数字ではない文字をふくむ1つの例"
94
+ exp = false
95
+ assert_equal( exp, ret )
96
+
97
+ end
98
+
99
+ end
100
+
101
+
102
+ #### endof filename: test_kannum.rb
metadata CHANGED
@@ -1,85 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: digit_delim
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - YAMAMOTO, Masayuki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-24 00:00:00.000000000 Z
11
+ date: 2016-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: shoulda
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '>='
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rdoc
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ~>
32
- - !ruby/object:Gem::Version
33
- version: '3.12'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ~>
39
- - !ruby/object:Gem::Version
40
- version: '3.12'
41
13
  - !ruby/object:Gem::Dependency
42
14
  name: bundler
43
15
  requirement: !ruby/object:Gem::Requirement
44
16
  requirements:
45
- - - ~>
17
+ - - ">="
46
18
  - !ruby/object:Gem::Version
47
19
  version: 1.3.5
48
20
  type: :development
49
21
  prerelease: false
50
22
  version_requirements: !ruby/object:Gem::Requirement
51
23
  requirements:
52
- - - ~>
24
+ - - ">="
53
25
  - !ruby/object:Gem::Version
54
26
  version: 1.3.5
55
27
  - !ruby/object:Gem::Dependency
56
28
  name: jeweler
57
29
  requirement: !ruby/object:Gem::Requirement
58
30
  requirements:
59
- - - ~>
31
+ - - ">="
60
32
  - !ruby/object:Gem::Version
61
33
  version: 1.8.4
62
34
  type: :development
63
35
  prerelease: false
64
36
  version_requirements: !ruby/object:Gem::Requirement
65
37
  requirements:
66
- - - ~>
38
+ - - ">="
67
39
  - !ruby/object:Gem::Version
68
40
  version: 1.8.4
69
41
  - !ruby/object:Gem::Dependency
70
- name: simplecov-rcov
42
+ name: test-unit
71
43
  requirement: !ruby/object:Gem::Requirement
72
44
  requirements:
73
- - - '>='
45
+ - - ">="
74
46
  - !ruby/object:Gem::Version
75
- version: '0'
47
+ version: 3.1.5
76
48
  type: :development
77
49
  prerelease: false
78
50
  version_requirements: !ruby/object:Gem::Requirement
79
51
  requirements:
80
- - - '>='
52
+ - - ">="
81
53
  - !ruby/object:Gem::Version
82
- version: '0'
54
+ version: 3.1.5
83
55
  description: methods of num-string formatter, converter which extends String class
84
56
  email: martin.route66.blues+github@gmail.com
85
57
  executables: []
@@ -87,7 +59,7 @@ extensions: []
87
59
  extra_rdoc_files:
88
60
  - LICENSE.txt
89
61
  files:
90
- - .document
62
+ - ".document"
91
63
  - Gemfile
92
64
  - Gemfile.lock
93
65
  - LICENSE.txt
@@ -96,8 +68,10 @@ files:
96
68
  - VERSION
97
69
  - digit_delim.gemspec
98
70
  - lib/digit_delim.rb
71
+ - lib/kannum.rb
99
72
  - test/helper.rb
100
73
  - test/test_digit_delim.rb
74
+ - test/test_kannum.rb
101
75
  homepage: http://github.com/mephistobooks/digit_delim
102
76
  licenses:
103
77
  - MIT
@@ -108,17 +82,17 @@ require_paths:
108
82
  - lib
109
83
  required_ruby_version: !ruby/object:Gem::Requirement
110
84
  requirements:
111
- - - '>='
85
+ - - ">="
112
86
  - !ruby/object:Gem::Version
113
87
  version: '0'
114
88
  required_rubygems_version: !ruby/object:Gem::Requirement
115
89
  requirements:
116
- - - '>='
90
+ - - ">="
117
91
  - !ruby/object:Gem::Version
118
92
  version: '0'
119
93
  requirements: []
120
94
  rubyforge_project:
121
- rubygems_version: 2.1.9
95
+ rubygems_version: 2.5.1
122
96
  signing_key:
123
97
  specification_version: 4
124
98
  summary: A little num-string formatter, converter.