crusher 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/crusher/load_generator.rb +7 -5
  2. metadata +5 -4
@@ -25,15 +25,17 @@ module Crusher
25
25
 
26
26
  def log_stats(event_type, data)
27
27
  keys, values = data.map{|k,v| [k.to_s,v.to_s] }.transpose
28
- stats_log_file(event_type).syswrite "#{Time.now.strftime('%Y-%m-%d %H:%M:%S')},#{values.join(',')}\n"
28
+ stats_log_file(event_type) do |file|
29
+ file.syswrite "#{Time.now.strftime('%Y-%m-%d %H:%M:%S')},#{values.join(',')}\n"
30
+ end
29
31
  end
30
32
 
31
33
  def stats_log_file(event_type)
32
34
  event_type = event_type.to_sym
33
- @stats_logs ||= {}
34
- @stats_logs[event_type] ||= File.open(File.join(@options[:stats_log_dir], "#{event_type}.csv"), 'a')
35
- end
36
-
35
+ File.open(File.join(@options[:stats_log_dir], "#{event_type}.csv"), 'a') do |file|
36
+ yield file
37
+ end
38
+ end
37
39
  end
38
40
 
39
41
  end
metadata CHANGED
@@ -1,22 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crusher
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - phene
14
14
  - thatothermitch
15
+ - scashin133
15
16
  autorequire:
16
17
  bindir: bin
17
18
  cert_chain: []
18
19
 
19
- date: 2010-11-09 00:00:00 -08:00
20
+ date: 2010-12-17 00:00:00 -08:00
20
21
  default_executable:
21
22
  dependencies:
22
23
  - !ruby/object:Gem::Dependency