dummer 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,9 @@
1
+ ### 0.3.4 (2014/04/12)
2
+
3
+ Enhancements:
4
+
5
+ * Add `label_delimiter` option. #4 (thanks suzuken)
6
+
1
7
  ### 0.3.3 (2014/02/20)
2
8
 
3
9
  Enhancement:
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`.
@@ -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}:#{val}" }.join(delimiter)}\n" }
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Dummer
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
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.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-02-20 00:00:00.000000000 Z
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: 652710321
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: 652710321
203
+ hash: 361854449
204
204
  requirements: []
205
205
  rubyforge_project:
206
206
  rubygems_version: 1.8.23