fileconv 0.2.2 → 0.3.O

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a708123572b69d7b44b6c8a9f409df95554a07ac0a7fcbdd0b649b187584e06d
4
- data.tar.gz: 8985be55557557066289a2e00dc517b2611dd733b9aeb6f698af3d1a2b90e90a
3
+ metadata.gz: 0ecad965c2a28bfba118d4d94a42a559eb1edee48916994021af11c2e5343a8a
4
+ data.tar.gz: 6e830496d36781e5178804c20f458d109f3c689327ce290e2991d5643650a7ce
5
5
  SHA512:
6
- metadata.gz: f227c444b154e4b74d043070188858bca74cedd472d4e2727db2acef35e869f98500b284dce4b4358ad89d031899b806dfc4f7236c1d806772e6fa40f69d9756
7
- data.tar.gz: 9befc404adf322e8869686f2f12367f507f84c8d3c06e87661b24d7b01e24a0dd89fa929a72408c568b6adca4a601947c246aa415d58363f1e2fad39184b8242
6
+ metadata.gz: 4eeb9d8936d51b5690baebadde9b7d186469f667bd07e8d3e49051d9324b5bef51fe1f6ac4929a33e162e4b5bc8647cfabca2a1980a7ed032a4240362ba28e96
7
+ data.tar.gz: 5f555288238410eff799f3272ade88cbb026a3c880c2a44acc02006d4112ceed53aa9f57a155fbfd3935d7324ae7fbd65a1c03fd71d6780da1089df4a4aa6ac5
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fileconv (0.2.2)
4
+ fileconv (0.3.O)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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 convertor|
137
- |CSV|Line|CSV line convertor|
138
- |Data|File|raw file data convertor|
139
- |File|File|`File` convertor|
140
- |JSON|File|JSON convertor|
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` hooks is called.
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` hooks is not called.
149
- - e.g. `Data`, `File`, `JSON`
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::Data
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(data, acc)
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
@@ -0,0 +1,3 @@
1
+ aaa
2
+ bbb
3
+ ccc
@@ -0,0 +1,15 @@
1
+ require 'fileconv/base'
2
+
3
+ module Fileconv
4
+ module Stat
5
+ include Fileconv::Base
6
+
7
+ def pre_init_conv
8
+ @opts[:disable_read_file] = true
9
+ end
10
+
11
+ def pre_convert_file(data, acc)
12
+ ::File.stat(acc[:orig_filename])
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module Fileconv
2
- VERSION = "0.2.2"
2
+ VERSION = "0.3.O"
3
3
  end
data/lib/fileconv.rb CHANGED
@@ -7,4 +7,5 @@ module Fileconv
7
7
  autoload :Data, 'fileconv/data'
8
8
  autoload :File, 'fileconv/file'
9
9
  autoload :JSON, 'fileconv/json'
10
+ autoload :Stat, 'fileconv/stat'
10
11
  end
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.2.2
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-09 00:00:00.000000000 Z
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: '0'
115
+ version: 1.3.1
113
116
  requirements: []
114
117
  rubygems_version: 3.0.6
115
118
  signing_key: