fileconv 0.2.2 → 0.3.O
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +11 -8
- data/example/{data → stat}/list_file.rb +2 -8
- data/example/stat/test.data +1 -0
- data/example/stat/test.txt +3 -0
- data/lib/fileconv/stat.rb +15 -0
- data/lib/fileconv/version.rb +1 -1
- data/lib/fileconv.rb +1 -0
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ecad965c2a28bfba118d4d94a42a559eb1edee48916994021af11c2e5343a8a
|
4
|
+
data.tar.gz: 6e830496d36781e5178804c20f458d109f3c689327ce290e2991d5643650a7ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4eeb9d8936d51b5690baebadde9b7d186469f667bd07e8d3e49051d9324b5bef51fe1f6ac4929a33e162e4b5bc8647cfabca2a1980a7ed032a4240362ba28e96
|
7
|
+
data.tar.gz: 5f555288238410eff799f3272ade88cbb026a3c880c2a44acc02006d4112ceed53aa9f57a155fbfd3935d7324ae7fbd65a1c03fd71d6780da1089df4a4aa6ac5
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -133,20 +133,23 @@ You can use several convertor variables. Convertor variables are `Hash` type and
|
|
133
133
|
|
134
134
|
|MetaConvertor|mode|description|
|
135
135
|
|---|---|---|
|
136
|
-
|Line|Line|raw line
|
137
|
-
|CSV|Line|CSV line
|
138
|
-
|Data|File|raw file data
|
139
|
-
|File|File
|
140
|
-
|
|
136
|
+
|Line|Line|get raw line data|
|
137
|
+
|CSV|Line|get a CSV line(`Array` or `Row`)|
|
138
|
+
|Data|File|get raw file data|
|
139
|
+
|File|File|get a `File` object|
|
140
|
+
|Stat|File|get a `Stat` object|
|
141
|
+
|JSON|File|get a `JSON` object|
|
141
142
|
|
142
143
|
Convertors(includes MetaConvertors) can be divided into two modes.
|
143
144
|
|
144
145
|
- Line Mode
|
145
|
-
- `#convert_line`
|
146
|
+
- `#convert_line` hook is called.
|
147
|
+
- `#convert_file` hook is called.
|
146
148
|
- e.g. `Line`, `CSV`
|
147
149
|
- File Mode
|
148
|
-
- `#convert_line`
|
149
|
-
-
|
150
|
+
- `#convert_line` hook is not called.
|
151
|
+
- `#convert_file` hook is called.
|
152
|
+
- e.g. `Data`, `File`, `Stat`, `JSON`
|
150
153
|
|
151
154
|
Let's see a JSON MetaConvertor usage.
|
152
155
|
|
@@ -1,19 +1,13 @@
|
|
1
1
|
require 'fileconv'
|
2
2
|
|
3
3
|
class ListFile
|
4
|
-
include Fileconv::
|
5
|
-
|
6
|
-
def input_ext
|
7
|
-
"data"
|
8
|
-
end
|
4
|
+
include Fileconv::Stat
|
9
5
|
|
10
6
|
def init_conv
|
11
7
|
@meta[:files] = []
|
12
|
-
@opts[:disable_read_file] = true
|
13
8
|
end
|
14
9
|
|
15
|
-
def convert_file(
|
16
|
-
stat = File.stat(acc[:orig_filename])
|
10
|
+
def convert_file(stat, acc)
|
17
11
|
@meta[:files].push [File.basename(acc[:orig_filename]), stat.size, stat.mtime]
|
18
12
|
nil
|
19
13
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
testtest
|
data/lib/fileconv/version.rb
CHANGED
data/lib/fileconv.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fileconv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.O
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hinastory
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -59,7 +59,6 @@ files:
|
|
59
59
|
- example/csv/test.csv
|
60
60
|
- example/csv/test2.txt
|
61
61
|
- example/csv/with_header.rb
|
62
|
-
- example/data/list_file.rb
|
63
62
|
- example/data/modify_and_base64.rb
|
64
63
|
- example/data/test.data
|
65
64
|
- example/data/test2.data
|
@@ -81,6 +80,9 @@ files:
|
|
81
80
|
- example/line/uniq_line.rb
|
82
81
|
- example/meta_convertor/csv2json.rb
|
83
82
|
- example/meta_convertor/test.csv
|
83
|
+
- example/stat/list_file.rb
|
84
|
+
- example/stat/test.data
|
85
|
+
- example/stat/test.txt
|
84
86
|
- fileconv.gemspec
|
85
87
|
- lib/fileconv.rb
|
86
88
|
- lib/fileconv/base.rb
|
@@ -89,6 +91,7 @@ files:
|
|
89
91
|
- lib/fileconv/file.rb
|
90
92
|
- lib/fileconv/json.rb
|
91
93
|
- lib/fileconv/line.rb
|
94
|
+
- lib/fileconv/stat.rb
|
92
95
|
- lib/fileconv/version.rb
|
93
96
|
homepage: https://github.com/hinastory/fileconv
|
94
97
|
licenses:
|
@@ -107,9 +110,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
110
|
version: 2.3.0
|
108
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
112
|
requirements:
|
110
|
-
- - "
|
113
|
+
- - ">"
|
111
114
|
- !ruby/object:Gem::Version
|
112
|
-
version:
|
115
|
+
version: 1.3.1
|
113
116
|
requirements: []
|
114
117
|
rubygems_version: 3.0.6
|
115
118
|
signing_key:
|