fluent-plugin-xml-simple-filter 0.0.8 → 0.0.9

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: 8e7e6593cf524a370fa5403587bc3484e531cc1d
4
- data.tar.gz: dd3717eb18a1a02dc97b2a71e5ef1189658a49c9
3
+ metadata.gz: 0a1def9069be715d20f8304004a885d90952c870
4
+ data.tar.gz: c68e4ecf0fbb79db769ccf1008718276cdccd596
5
5
  SHA512:
6
- metadata.gz: 8aac8a14a1fad9a9230d103ccb3f93713b58ca3ded07179f6c081970acfcec0e17cead2a20e3a09ad65fe90546edf92a1bc2cbe82d5576fb8669cef1a6887188
7
- data.tar.gz: 47e87476620442a34d19577ec22c4ad6e1800a19965e4c93fb6e140dde708e35429cfe9fcc9db996f60c5236ed740e3b5ebb6a120cb06674b5b24c2ad520f433
6
+ metadata.gz: 90d5224dc82c28f58b799a99f7ce41efff15c677acdf98822e8efde1dbe65c57ab6e06f48e79063b463f0d817685e669cdc53d4a365df20c9fbba9b98ceff484
7
+ data.tar.gz: 1a0cff0178c9c5563ab3351e2f2e76610dd7a3686d7a77a45863c55c01404ef74fef6a57c3c525a1674860f4368bdba58c72418d344b95a21c81f583597cd7f6
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.9
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: fluent-plugin-xml-simple-filter 0.0.8 ruby lib
5
+ # stub: fluent-plugin-xml-simple-filter 0.0.9 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "fluent-plugin-xml-simple-filter".freeze
9
- s.version = "0.0.8"
9
+ s.version = "0.0.9"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
@@ -7,6 +7,7 @@ module Fluent
7
7
  config_param :fields, :string
8
8
 
9
9
  config_param :try_convert_times, :bool, :default => true # try to convert values in hash to times
10
+ config_param :time_format, :string, :default => '%F'
10
11
  config_param :field_name_postfix, :string, :default => 'hash' # if set will create hash in new field with postfix (xml => xml_hash)
11
12
 
12
13
  def configure(conf)
@@ -42,11 +43,7 @@ module Fluent
42
43
 
43
44
  hash = @parser.parse(record[field])
44
45
 
45
- if try_convert_times
46
- hash = convert_times(hash)
47
- end
48
-
49
- record[field_name] = hash
46
+ record[field_name] = self.try_convert_times ? convert_times(hash) : hash
50
47
  end
51
48
  }
52
49
 
@@ -56,7 +53,11 @@ module Fluent
56
53
  private
57
54
 
58
55
  def convert_times(hash)
59
- hash.each { |key, value| value.class == Hash ? convert_times(value) : try_to_convert(value) { |x| Time.parse(x) } }
56
+ hash.each { |key, value|
57
+ value.class == Hash ? convert_times(value) : try_to_convert(value) { |x|
58
+ self.time_format ? Time.strptime(x, self.time_format) : Time.parse(x)
59
+ }
60
+ }
60
61
  end
61
62
 
62
63
  def try_to_convert(value, &block)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-xml-simple-filter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yaroslav Lukyanov