gogo_csv 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/gogo_csv/array.rb +2 -2
- data/lib/gogo_csv/matrix.rb +1 -1
- data/lib/gogo_csv/version.rb +1 -1
- data/lib/gogo_csv.rb +5 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7de619d3220299cc5c0659f6119a9b8a4229234
|
4
|
+
data.tar.gz: c50b615ee188e5ca7ad46ce2e90224540fff6976
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04c9d963cd0981bc75cb4e1a2c4507043f13537cafc37a46d2a10610f63b1d0010a1733fe107a95319254fafc708b300ece44401c046b0ab4dd49605165ccd15
|
7
|
+
data.tar.gz: bb1722d53c94397a748540fcc41efbe1f1e4ca87f186a6a513c8e75d3c4118629d39366f220823ffa3cf4620af6477ab5786e3f69a0d4989217990396ba4d897
|
data/README.md
CHANGED
data/lib/gogo_csv/array.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module GogoCsv
|
2
2
|
class ::Array
|
3
|
-
def save!(path)
|
3
|
+
def save!(path=nil)
|
4
4
|
raise 'should be array of array' unless arys?
|
5
|
-
raise 'Should supply file path' unless path ||= $
|
5
|
+
raise 'Should supply file path' unless path ||= $current_path
|
6
6
|
|
7
7
|
CSV.open(File.expand_path(path), "wb") do |csv|
|
8
8
|
each { |ary| csv << ary }
|
data/lib/gogo_csv/matrix.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module GogoCsv
|
2
2
|
class ::Matrix
|
3
3
|
def save!(path=nil)
|
4
|
-
raise 'Should supply file path' unless path ||= $
|
4
|
+
raise 'Should supply file path' unless path ||= $current_path
|
5
5
|
CSV.open(File.expand_path(path), "wb") do |csv|
|
6
6
|
row_vectors.each { |v| csv << v.to_a }
|
7
7
|
end
|
data/lib/gogo_csv/version.rb
CHANGED
data/lib/gogo_csv.rb
CHANGED
@@ -6,20 +6,17 @@ module GogoCsv
|
|
6
6
|
require 'csv'
|
7
7
|
require 'matrix'
|
8
8
|
|
9
|
-
def
|
10
|
-
$
|
9
|
+
def _(path, format=:arys)
|
10
|
+
$current_path = path
|
11
11
|
arys = CSV.read(
|
12
12
|
File.expand_path(path)
|
13
13
|
)
|
14
14
|
|
15
|
-
case format
|
16
|
-
when :matrix
|
17
|
-
|
18
|
-
when :arys
|
19
|
-
arys
|
15
|
+
$original_csv = case format
|
16
|
+
when :matrix then Matrix[*arys]
|
17
|
+
when :arys then arys
|
20
18
|
end
|
21
19
|
end
|
22
|
-
module_function :open
|
23
20
|
end
|
24
21
|
|
25
22
|
include GogoCsv
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gogo_csv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gogotanaka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|