embulk-formatter-jsonl 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -17,6 +17,11 @@ Format datum to jsonl, 1 json per 1 line
17
17
  - CR: use `\r`(0x0d) as newline character
18
18
  - NUL: use `\0`(0x00) instead of newline (for example, `xargs -0` will be good friend with it)
19
19
  - NO: dump JSONs in a line
20
+ - **date_format**: date format. See below example. (string default: nil)
21
+ - "yyyy-MM-dd HH:mm:ss": 2015-04-26 17:23:25
22
+ - "yyyy-MM-dd'T'HH:mm:ss.SSSZ": 2015-04-26T17:23:25.123+0900
23
+ - For more information: [SimpleDateFormat class document](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html)
24
+ - **timezone**: timezone. "JST" (string default: nil)
20
25
 
21
26
  ## Example
22
27
 
@@ -1,7 +1,7 @@
1
1
 
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "embulk-formatter-jsonl"
4
- spec.version = "0.1.3"
4
+ spec.version = "0.1.4"
5
5
  spec.authors = ["TAKEI Yuya"]
6
6
  spec.summary = "Jsonl formatter plugin for Embulk"
7
7
  spec.description = "Formats Embulk Formatter Jsonl files for other file output plugins."
@@ -27,6 +27,8 @@ module Embulk
27
27
  task = {
28
28
  'encoding' => config.param('encoding', :string, default: 'UTF-8'),
29
29
  'newline' => config.param('newline', :string, default: 'LF'),
30
+ 'date_format' => config.param('date_format', :string, default: nil),
31
+ 'timezone' => config.param('timezone', :string, default: nil )
30
32
  }
31
33
 
32
34
  encoding = task['encoding'].upcase
@@ -46,6 +48,11 @@ module Embulk
46
48
  # your data
47
49
  @current_file == nil
48
50
  @current_file_size = 0
51
+ @opts = { :mode => :compat }
52
+ date_format = task['date_format']
53
+ timezone = task['timezone']
54
+ @opts[:date_format] = date_format if date_format
55
+ @opts[:timezone] = timezone if timezone
49
56
  end
50
57
 
51
58
  def close
@@ -62,7 +69,7 @@ module Embulk
62
69
  @schema.each do |col|
63
70
  datum[col.name] = record[col.index]
64
71
  end
65
- @current_file.write "#{JrJackson::Json.dump(datum, :mode => :compat)}#{@newline}".encode(@encoding)
72
+ @current_file.write "#{JrJackson::Json.dump(datum, @opts )}#{@newline}".encode(@encoding)
66
73
  end
67
74
  end
68
75
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-formatter-jsonl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-26 00:00:00.000000000 Z
12
+ date: 2015-04-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jrjackson
@@ -86,17 +86,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
86
86
  - - ! '>='
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
+ segments:
90
+ - 0
91
+ hash: 1982763760097930415
89
92
  required_rubygems_version: !ruby/object:Gem::Requirement
90
93
  none: false
91
94
  requirements:
92
95
  - - ! '>='
93
96
  - !ruby/object:Gem::Version
94
97
  version: '0'
98
+ segments:
99
+ - 0
100
+ hash: 1982763760097930415
95
101
  requirements: []
96
102
  rubyforge_project:
97
- rubygems_version: 1.8.23
103
+ rubygems_version: 1.8.23.2
98
104
  signing_key:
99
105
  specification_version: 3
100
106
  summary: Jsonl formatter plugin for Embulk
101
107
  test_files: []
102
- has_rdoc: