fluent-plugin-xml-simple-filter 0.0.19 → 0.0.20

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: 0f6480ed1aa118fa20d0170ec93422a6d0e86990
4
- data.tar.gz: f2db4875454a0f7a2095ae2800f2f1df41e5f2b8
3
+ metadata.gz: f40e60a3c87d21fdc4f35457788cdbd8eced1f70
4
+ data.tar.gz: d8a086c7c2f506b2edf9bb50f347cffeb866bdb1
5
5
  SHA512:
6
- metadata.gz: 694053ff5f3d9ac0eff1fab9ebafce63d90580a94a282008d7cd828347c3ba72caa1a99e1aff7932f7483dc12d158fb69712fe5094b48eef128a56555e74d7eb
7
- data.tar.gz: 54f76592fc66b7e297ca5829ea6ee5b8c07d3bc26a9edd8f1f9a5acc5dbd0cc28ab3be23c05a60f6d3b3317371e367728161a8e3833c97a5d49eba942f81cdb2
6
+ metadata.gz: 830780c92d919e6a8697dba997b7144ad00647f006b358b10f78f574b1c2a6d05d20a7ed65ee471d59b720e32107af48ad441eda950d6ff33447ca35141167a1
7
+ data.tar.gz: db9596b1e8cd0c3598b8d12329a14da612f47a491117fa75a6e49ff5e7597cfd751fb448c3311b4b45bde7c718125a6fb87ebc7130952fa75a3e9e1e8fd8e316
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.19
1
+ 0.0.20
@@ -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.19 ruby lib
5
+ # stub: fluent-plugin-xml-simple-filter 0.0.20 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.19"
9
+ s.version = "0.0.20"
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]
@@ -6,7 +6,7 @@ module Fluent
6
6
 
7
7
  config_param :fields, :string
8
8
 
9
- config_param :try_convert_times, :bool, :default => true # try to convert values in hash to times
9
+ config_param :try_convert_times, :bool, :default => false # try to convert values in hash to timestamps
10
10
  config_param :time_format, :string, :default => nil
11
11
  config_param :field_name_postfix, :string, :default => 'hash' # if set will create hash in new field with postfix (xml => xml_hash)
12
12
 
@@ -55,16 +55,30 @@ module Fluent
55
55
 
56
56
  private
57
57
 
58
- def convert_times(hash)
59
- hash.map { |key, value|
60
- new_value = value.class == Hash ? convert_times(value) : try_to_convert(value) { |x|
58
+ def convert_to_time(value)
59
+ if value.class == Hash
60
+ convert_times(value)
61
+ elsif value.class == Array
62
+ convert_times_array(value)
63
+ else
64
+ try_to_convert(value) { |x|
61
65
  (self.time_format ? Time.strptime(x, self.time_format) : Time.parse(x)).to_i
62
66
  }
67
+ end
68
+ end
63
69
 
64
- [key, new_value]
70
+ def convert_times(hash)
71
+ hash.map { |key, value|
72
+ [key, convert_to_time(value)]
65
73
  }.to_h
66
74
  end
67
75
 
76
+ def convert_times_array(array)
77
+ array.map { |value|
78
+ convert_to_time(value)
79
+ }
80
+ end
81
+
68
82
  def try_to_convert(value, &block)
69
83
  block.call(value)
70
84
  rescue Exception => e
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.19
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yaroslav Lukyanov