carray-io-csv 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/carray-io-csv.gemspec +2 -2
- data/lib/carray-io-csv/core.rb +7 -11
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9cb40651d13b603f919dced66f36937c7b116381be98f4d2e27ce9bf69608c4
|
4
|
+
data.tar.gz: 8b5c8cc847d24dc3ba46b1969da7f2ede0fdcc18646577db32883a7a8b70b9e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3bfe3db49f4c1ce530bf5a640d9ba4d6fd3f2673ee813fa3b2de778de86fbf9ec1618e3a5a2fbd0883b981159a92329f0ea9ec9b81df938b606c36199aa6462
|
7
|
+
data.tar.gz: 6ccb47ecd46ecacac1c13dba205206527d2ac4692226c1659cc9f1affe60bd8f6a45e1c6899b960a1d1f0b7a2591a3fc4933193b29f77376b6ffa8ed62939da5
|
data/carray-io-csv.gemspec
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
Gem::Specification::new do |s|
|
2
|
-
version = "0.9.
|
2
|
+
version = "0.9.1"
|
3
3
|
files = Dir.glob("**/*") - [
|
4
4
|
Dir.glob("carray-io-csv-*.gem"),
|
5
5
|
Dir.glob("test/**/*"),
|
@@ -13,7 +13,7 @@ Gem::Specification::new do |s|
|
|
13
13
|
CSV interface for CArray
|
14
14
|
HERE
|
15
15
|
s.version = version
|
16
|
-
s.
|
16
|
+
s.license = 'MIT'
|
17
17
|
s.author = "Hiroki Motoyoshi"
|
18
18
|
s.email = ""
|
19
19
|
s.homepage = 'https://github.com/himotoyoshi/carray-io-csv'
|
data/lib/carray-io-csv/core.rb
CHANGED
@@ -66,7 +66,6 @@
|
|
66
66
|
# data.to_csv([io|string]) { ... definitions ... }
|
67
67
|
#
|
68
68
|
|
69
|
-
require "carray/io/table"
|
70
69
|
require "stringio"
|
71
70
|
require "rcsv"
|
72
71
|
require "strscan"
|
@@ -142,7 +141,7 @@ module CA
|
|
142
141
|
@header = header
|
143
142
|
@note = note
|
144
143
|
}
|
145
|
-
@table.extend(
|
144
|
+
@table.extend(CArray::TableMethods)
|
146
145
|
@table.column_names = header["names"]
|
147
146
|
class << @table
|
148
147
|
attr_reader :note
|
@@ -562,15 +561,13 @@ class CArray
|
|
562
561
|
end
|
563
562
|
end
|
564
563
|
|
565
|
-
def save_csv (file,
|
566
|
-
|
567
|
-
writer
|
568
|
-
return writer.write_file(self, file, option[:mode])
|
564
|
+
def save_csv (file, rs: $/, sep: ",", fill: "", mode: "w", &block)
|
565
|
+
writer = CA::CSVWriter.new(sep, rs, fill, &block)
|
566
|
+
return writer.write_file(self, file, mode)
|
569
567
|
end
|
570
568
|
|
571
|
-
def to_csv (io="",
|
572
|
-
|
573
|
-
writer = CA::CSVWriter.new(option[:sep], option[:rs], option[:fill], &block)
|
569
|
+
def to_csv (io="", rs: $/, sep: ",", fill: "", &block)
|
570
|
+
writer = CA::CSVWriter.new(sep, rs, fill, &block)
|
574
571
|
case io
|
575
572
|
when IO, StringIO
|
576
573
|
return writer.write_io(self, io)
|
@@ -579,7 +576,7 @@ class CArray
|
|
579
576
|
end
|
580
577
|
end
|
581
578
|
|
582
|
-
def to_tabular (option
|
579
|
+
def to_tabular (**option)
|
583
580
|
option = {:sep=>" ", :names=>nil}.update(option)
|
584
581
|
if option[:names]
|
585
582
|
names = option[:names]
|
@@ -592,6 +589,5 @@ class CArray
|
|
592
589
|
length = table.convert{|s| s.length}.max(0)
|
593
590
|
table.map_with_index! {|s, idx| s.rjust(length[idx[1]]) }.to_csv.gsub(/,/,sep)
|
594
591
|
end
|
595
|
-
|
596
592
|
end
|
597
593
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carray-io-csv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroki Motoyoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: carray
|
@@ -67,8 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
requirements: []
|
70
|
-
|
71
|
-
rubygems_version: 2.7.7
|
70
|
+
rubygems_version: 3.1.2
|
72
71
|
signing_key:
|
73
72
|
specification_version: 4
|
74
73
|
summary: CSV interface for CArray
|