dummer 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/README.md +4 -0
- data/lib/dummer/generator.rb +5 -5
- data/lib/dummer/setting.rb +2 -1
- data/lib/dummer/version.rb +1 -1
- metadata +4 -4
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -167,6 +167,10 @@ Following parameters in the configuration file are available:
|
|
167
167
|
|
168
168
|
Whether add field name as a label or not. Default: true
|
169
169
|
|
170
|
+
* label_delimiter
|
171
|
+
|
172
|
+
Specify the delimiter between the label and the value. Default: ":" (column)
|
173
|
+
|
170
174
|
* tag
|
171
175
|
|
172
176
|
Define tag field to generate. This is effective only for posting data to fluentd process with `host` and `port`.
|
data/lib/dummer/generator.rb
CHANGED
@@ -3,7 +3,7 @@ module Dummer
|
|
3
3
|
def initialize(setting)
|
4
4
|
@message_proc =
|
5
5
|
if fields = setting.fields
|
6
|
-
Field.message_proc(fields, setting.labeled, setting.delimiter)
|
6
|
+
Field.message_proc(fields, setting.labeled, setting.delimiter, setting.label_delimiter)
|
7
7
|
elsif input = setting.input
|
8
8
|
Input.message_proc(input)
|
9
9
|
else
|
@@ -74,8 +74,8 @@ module Dummer
|
|
74
74
|
end
|
75
75
|
|
76
76
|
class Field
|
77
|
-
def self.message_proc(fields, labeled, delimiter)
|
78
|
-
format_proc = format_proc(labeled, delimiter)
|
77
|
+
def self.message_proc(fields, labeled, delimiter, label_delimiter)
|
78
|
+
format_proc = format_proc(labeled, delimiter, label_delimiter)
|
79
79
|
record_proc = record_proc(fields)
|
80
80
|
|
81
81
|
Proc.new {
|
@@ -102,9 +102,9 @@ module Dummer
|
|
102
102
|
field_procs({"tag" => tag_opts})["tag"]
|
103
103
|
end
|
104
104
|
|
105
|
-
def self.format_proc(labeled, delimiter)
|
105
|
+
def self.format_proc(labeled, delimiter, label_delimiter)
|
106
106
|
if labeled
|
107
|
-
Proc.new {|fields| "#{fields.map {|key, val| "#{key}
|
107
|
+
Proc.new {|fields| "#{fields.map {|key, val| "#{key}#{label_delimiter}#{val}" }.join(delimiter)}\n" }
|
108
108
|
else
|
109
109
|
Proc.new {|fields| "#{fields.values.join(delimiter)}\n" }
|
110
110
|
end
|
data/lib/dummer/setting.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Dummer
|
2
2
|
class Setting
|
3
|
-
attr_accessor :rate, :output, :labeled, :delimiter, :fields, :workers, :message, :input
|
3
|
+
attr_accessor :rate, :output, :labeled, :label_delimiter, :delimiter, :fields, :workers, :message, :input
|
4
4
|
attr_accessor :host, :port, :tag
|
5
5
|
|
6
6
|
def initialize
|
@@ -9,6 +9,7 @@ module Dummer
|
|
9
9
|
@host = nil
|
10
10
|
@port = 24224
|
11
11
|
@labeled = true
|
12
|
+
@label_delimiter = ":"
|
12
13
|
@delimiter = "\t"
|
13
14
|
@tag = {type: :string, value: "dummer"}
|
14
15
|
@fields = nil
|
data/lib/dummer/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dummer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.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: 2014-
|
12
|
+
date: 2014-04-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -191,7 +191,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
191
191
|
version: '0'
|
192
192
|
segments:
|
193
193
|
- 0
|
194
|
-
hash:
|
194
|
+
hash: 361854449
|
195
195
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
196
|
none: false
|
197
197
|
requirements:
|
@@ -200,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
200
200
|
version: '0'
|
201
201
|
segments:
|
202
202
|
- 0
|
203
|
-
hash:
|
203
|
+
hash: 361854449
|
204
204
|
requirements: []
|
205
205
|
rubyforge_project:
|
206
206
|
rubygems_version: 1.8.23
|