embulk-filter-ruby_proc 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -5
- data/embulk-filter-ruby_proc.gemspec +1 -1
- data/example/comment_upcase.rb +4 -0
- data/example/config.yml +1 -5
- data/lib/embulk/filter/ruby_proc.rb +5 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4abe5f3c208a186c9d25e8a8996cd9c7b210b9c2
|
4
|
+
data.tar.gz: eb284df63dabdc64a7068ab98bba99ea60b51139
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e616ad4b49d0d5b05b336ff66bbf522ed18240973c1e192315b71db0096d37d88f1cabb31b6f621de471a6973faffcccf1e8dbf6020bcadaec3e8b16111e618c
|
7
|
+
data.tar.gz: 5f8e9e54f3ee58debbf2fd9a2b45a0e73e7b4b1014c4fef25bdb9ab684a90522cdd50c34628f754d553ea762fe713da2b1dcdb613b41bd1c78013505f9126850
|
data/README.md
CHANGED
@@ -48,11 +48,7 @@ filters:
|
|
48
48
|
end
|
49
49
|
type: string
|
50
50
|
- name: comment
|
51
|
-
|
52
|
-
->(comment, record) do
|
53
|
-
return [record["account"].to_s].to_json unless comment
|
54
|
-
comment.upcase.split(" ").map { |s| CGI.escape(s) }
|
55
|
-
end
|
51
|
+
proc_file: comment_upcase.rb
|
56
52
|
skip_nil: false
|
57
53
|
type: json
|
58
54
|
target: events
|
@@ -61,6 +57,15 @@ filters:
|
|
61
57
|
|
62
58
|
```
|
63
59
|
|
60
|
+
```rb
|
61
|
+
# comment_upcase.rb
|
62
|
+
|
63
|
+
->(comment, record) do
|
64
|
+
return [record["account"].to_s].to_json unless comment
|
65
|
+
comment.upcase.split(" ").map { |s| CGI.escape(s) }
|
66
|
+
end
|
67
|
+
```
|
68
|
+
|
64
69
|
### preview
|
65
70
|
```
|
66
71
|
+-----------+--------------+-------------------------+-------------------------+------------------------------------------+------------------------------------------------------------------------------------------+
|
data/example/config.yml
CHANGED
@@ -41,11 +41,7 @@ filters:
|
|
41
41
|
end
|
42
42
|
type: string
|
43
43
|
- name: comment
|
44
|
-
|
45
|
-
->(comment, record) do
|
46
|
-
return [record["account"].to_s].to_json unless comment
|
47
|
-
comment.upcase.split(" ").map { |s| CGI.escape(s) }
|
48
|
-
end
|
44
|
+
proc_file: comment_upcase.rb
|
49
45
|
skip_nil: false
|
50
46
|
type: json
|
51
47
|
target: events
|
@@ -28,7 +28,11 @@ module Embulk
|
|
28
28
|
require lib
|
29
29
|
end
|
30
30
|
@procs = Hash[task["columns"].map {|col|
|
31
|
-
|
31
|
+
if col["proc"]
|
32
|
+
[col["name"], eval(col["proc"])]
|
33
|
+
else
|
34
|
+
[col["name"], eval(File.read(col["proc_file"]), binding, File.expand_path(col["proc_file"]))]
|
35
|
+
end
|
32
36
|
}]
|
33
37
|
@skip_nils = Hash[task["columns"].map {|col|
|
34
38
|
[col["name"], col["skip_nil"].nil? ? true : !!col["skip_nil"]]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-filter-ruby_proc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- joker1007
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: embulk
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- README.md
|
67
67
|
- Rakefile
|
68
68
|
- embulk-filter-ruby_proc.gemspec
|
69
|
+
- example/comment_upcase.rb
|
69
70
|
- example/config.yml
|
70
71
|
- example/sample_01.csv
|
71
72
|
- lib/embulk/filter/ruby_proc.rb
|