mymatrix 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mymatrix.rb +5 -2
- data/lib/mymatrix/version.rb +1 -1
- data/spec/jptest.txt +2 -0
- data/spec/mymatrix_spec.rb +8 -0
- data/spec/std_shoshiki.xls +0 -0
- metadata +5 -3
data/lib/mymatrix.rb
CHANGED
@@ -71,9 +71,12 @@ class MyMatrix
|
|
71
71
|
# ====Return
|
72
72
|
# UTF8 String
|
73
73
|
def self.toutf8(str)
|
74
|
-
#out = NKF.nkf('-x -w --cp932', str)
|
75
74
|
#入力がShift-jisであるとする。
|
76
|
-
|
75
|
+
if(RUBY_VERSION =~ /1\.[^9]/)
|
76
|
+
out = NKF.nkf('-S -x -w --cp932', str)
|
77
|
+
else
|
78
|
+
out = str.encode('UTF-8')
|
79
|
+
end
|
77
80
|
return out
|
78
81
|
end
|
79
82
|
|
data/lib/mymatrix/version.rb
CHANGED
data/spec/jptest.txt
ADDED
data/spec/mymatrix_spec.rb
CHANGED
@@ -64,6 +64,9 @@ describe MyMatrix do
|
|
64
64
|
|
65
65
|
it 'XLSで表示されている通りの値がStringとして取得できること' do
|
66
66
|
@mx = MyMatrix.new('spec/std_shoshiki.xls')
|
67
|
+
@mx[0][0].should == '標準書式での数値の扱い'
|
68
|
+
@mx[0][0].class.should == String
|
69
|
+
|
67
70
|
@mx[0][1].should == '1'
|
68
71
|
@mx[0][1].class.should == String
|
69
72
|
|
@@ -98,6 +101,11 @@ describe MyMatrix do
|
|
98
101
|
|
99
102
|
|
100
103
|
end
|
104
|
+
it 'tsvファイルを読めること' do
|
105
|
+
mx = MyMatrix.new('spec/jptest.txt')
|
106
|
+
mx.getHeaders[0].should == '日本語ヘッダ1'
|
107
|
+
mx[0][0].should == '値1value1'
|
108
|
+
end
|
101
109
|
|
102
110
|
it 'concatDirでフォルダ内ファイルを全て結合できること' do
|
103
111
|
mx = MyMatrix.new
|
data/spec/std_shoshiki.xls
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mymatrix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-03-27 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &2152866440 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2152866440
|
25
25
|
description: mymatrix is a handling library for MS Excel and csv/tsv text.
|
26
26
|
email:
|
27
27
|
- yukihico@gmail.com
|
@@ -47,6 +47,7 @@ files:
|
|
47
47
|
- spec/for_concat/con3.xls
|
48
48
|
- spec/for_concat/con4.xls
|
49
49
|
- spec/info_list.txt
|
50
|
+
- spec/jptest.txt
|
50
51
|
- spec/line4.txt
|
51
52
|
- spec/line4.xls
|
52
53
|
- spec/mymatrix_spec.rb
|
@@ -94,6 +95,7 @@ test_files:
|
|
94
95
|
- spec/for_concat/con3.xls
|
95
96
|
- spec/for_concat/con4.xls
|
96
97
|
- spec/info_list.txt
|
98
|
+
- spec/jptest.txt
|
97
99
|
- spec/line4.txt
|
98
100
|
- spec/line4.xls
|
99
101
|
- spec/mymatrix_spec.rb
|