fluent-plugin-reassemble 0.0.3 → 0.0.4

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTM4MDUxYWViOTIzNzEwZGZiNjI1MDI0ZGI5YzhiYThhYmUyMjlhYg==
4
+ OGFkMWVmMzc5MmU4OWQyOTYzYTNlY2JjZGJiNjM5YmY3OTNkMjMxZQ==
5
5
  data.tar.gz: !binary |-
6
- YTIyMzBlNzgyNjg0Y2JlZDBkYzljZDNjNjE0ZDc5ZmIyOTI5NGZiOQ==
6
+ NDFmNjc2ZDQxM2VlYTMwMDg0Yzk4OGQ5ZjBiYjNlZDFmZTQwOGJkNQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZWZmZTMwMzA3NDAyMzMxZjAyMzVmYzc3ODM2ZTk0OTkxNjY0NTMzZjBiZDM3
10
- ZWNkY2YxODEyNzU0NTkyMGFjYTE5OGE1ZDE0ZWE2ZTM1OGU0ZTIyN2VhN2Ew
11
- YjRlYjc3Y2M4NTUyZWQzZDNhOTQ1YWMwNjdhNTNjZWI3ZTBlZTg=
9
+ YWZkOTdjMTM0ODRlZTU2YmRmNjM4MjdkM2U0YTYwOWFjZTZmMmVjMTdlODBl
10
+ YzdmNDMyMDZmYTgyNzE0YjliNWJmMmZmNjM2NjEyNGQ4OTZkODM5YjIyZGM5
11
+ YzMxMjU5MjcwYjcwZDNlMTBhOGFmZWM5MWE0ZWI5ZGEwZTIyMjk=
12
12
  data.tar.gz: !binary |-
13
- NGU2N2NlZjU5OWEzNzM3MDNkNDMzZTFlOWQzNDAzMWFkMzFiYzcyODI5MjE0
14
- YjUxNzQxYTBlMGU5ZDIyZTBkZGM2ZWEwOGQ3NDg2NzZjZDRjZjRlN2ZhODI1
15
- NDllOTFhZDhhYjhkZmFmZDk2NzUwMjg1MGRjODQwNzhiMTViZTk=
13
+ Zjk3ZDBhZDZiOGJiN2YxM2ZiZWYwMDRiMDM1ZWMyM2ViOTZkNGU0OTY2ZGUz
14
+ YjE4ZmIxOTg4YmI1MjhiMjQ5YjJhNTdjZGU3NDg4MzkzNzQ1ZWJmOWUyZWY1
15
+ Nzk4Yjc3Nzg1ZjM2ZTBlNWQ1NWQzNDExZTgwYzkzZjVlOTdjMTM=
data/README.rdoc CHANGED
@@ -43,6 +43,11 @@ unixtime_to_time:: convert from unixtime to time(string)
43
43
  url_to_domain:: extract host from url
44
44
  url_to_host:: extract host from url
45
45
  url_to_path:: extract path from url
46
+ bool_to_i:: convert from bool to integer (true -> 1 / false -> 0)
47
+ add_[integer]:: addition (original value + integer)
48
+ sub_[integer]:: subtraction (original value - integer)
49
+ mul_[integer]:: multiplication (original value * integer)
50
+ div_[integer]:: division (original value / integer)
46
51
 
47
52
  == Copyright
48
53
 
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |gem|
3
3
  gem.name = "fluent-plugin-reassemble"
4
- gem.version = "0.0.3"
4
+ gem.version = "0.0.4"
5
5
  gem.authors = ["moaikids"]
6
6
  gem.licenses = ["Apache License Version 2.0"]
7
7
  gem.summary = %q{Re-assemble a stream data for Fluentd}
@@ -86,15 +86,22 @@ module Fluent
86
86
  if operation.nil?
87
87
  return val
88
88
  end
89
-
89
+
90
+ o = operation.downcase
90
91
  begin
91
- case operation.downcase
92
+ case o
92
93
  when "to_s"
93
94
  return val.to_s
94
95
  when "to_i"
95
96
  return val.to_i
96
97
  when "to_f"
97
98
  return val.to_f
99
+ when "bool_to_i"
100
+ if val
101
+ return 1
102
+ else
103
+ return 0
104
+ end
98
105
  when "unixtime_to_datetime"
99
106
  return Time.at(val.to_i).strftime(@datetime_format)
100
107
  when "unixtime_to_date"
@@ -105,6 +112,18 @@ module Fluent
105
112
  return URI(val.to_s).host
106
113
  when "url_to_path"
107
114
  return URI(val.to_s).path
115
+ when /^add_([\d]+)/
116
+ num = o.gsub(/^add_([\d]+)/, '\1').to_i
117
+ return val + num
118
+ when /^sub_([\d]+)/
119
+ num = o.gsub(/^sub_([\d]+)/, '\1').to_i
120
+ return val - num
121
+ when /^mul_([\d]+)/
122
+ num = o.gsub(/^mul_([\d]+)/, '\1').to_i
123
+ return val * num
124
+ when /^div_([\d]+)/
125
+ num = o.gsub(/^div_([\d]+)/, '\1').to_i
126
+ return val / num
108
127
  else
109
128
  return val
110
129
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-reassemble
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - moaikids
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-02 00:00:00.000000000 Z
11
+ date: 2013-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake