gogo_csv 0.0.2 → 0.0.3

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: 3e2dc57673003d632a097655c3dc4bc04016d04e
4
- data.tar.gz: b899d78da8b8fbf91520a99741fd2dba01fb6de1
3
+ metadata.gz: a7de619d3220299cc5c0659f6119a9b8a4229234
4
+ data.tar.gz: c50b615ee188e5ca7ad46ce2e90224540fff6976
5
5
  SHA512:
6
- metadata.gz: c801a1f46951c657e24c0de8af89b7253a361f19d238bec917a4fbf92671ae2e907daa6597336d9da8c6909ed104caa5dc7b6b5c9508a1af6e980c93b89545a1
7
- data.tar.gz: 5800b9cec06481cb5f2b20fd7f74fde05160dec634b670a9882666d28bd20992d4de75799c86929a7ec91f98127b7d8ae065925a6696cebd91f05c8a0cfe3956
6
+ metadata.gz: 04c9d963cd0981bc75cb4e1a2c4507043f13537cafc37a46d2a10610f63b1d0010a1733fe107a95319254fafc708b300ece44401c046b0ab4dd49605165ccd15
7
+ data.tar.gz: bb1722d53c94397a748540fcc41efbe1f1e4ca87f186a6a513c8e75d3c4118629d39366f220823ffa3cf4620af6477ab5786e3f69a0d4989217990396ba4d897
data/README.md CHANGED
@@ -13,9 +13,9 @@ Install gem as you like.
13
13
  ```
14
14
  require 'gogo_csv'
15
15
 
16
- arys = read('~/input.csv')
16
+ arys = _ '~/input.csv'
17
17
 
18
18
  # something you want to do ..
19
19
 
20
- arys.save!('~/output.csv')
20
+ arys.save!
21
21
  ```
@@ -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 ||= $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 }
@@ -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 ||= $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
@@ -1,3 +1,3 @@
1
1
  module GogoCsv
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/gogo_csv.rb CHANGED
@@ -6,20 +6,17 @@ module GogoCsv
6
6
  require 'csv'
7
7
  require 'matrix'
8
8
 
9
- def open(path, format=:matrix)
10
- $path = path
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
- Matrix[*arys]
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.2
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: 2014-11-21 00:00:00.000000000 Z
11
+ date: 2015-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler