myslog 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/myslog.rb +13 -13
  2. data/myslog.gemspec +1 -1
  3. metadata +3 -2
data/lib/myslog.rb CHANGED
@@ -66,21 +66,21 @@ class MySlog
66
66
  end
67
67
  elsif record.start_with? "#"
68
68
 
69
- # split with two space
70
- elems = record[2..-1].strip().split " "
71
- if elems.size == 1 && elems[0].start_with?("Time:")
72
- response[:date] = Time.parse(record[8..-1].strip)
69
+ elems = record[2..-1].strip().split " "
70
+ if elems.size == 3 && elems[0] == "Time:"
71
+ response[:date] = Time.parse(elems[1]+" "+elems[2])
73
72
  else
74
- elems.each do |elem|
75
- name, value = elem.split ":"
76
- value.strip!
77
- case value
78
- when /^\d+$/
79
- value = value.to_i
80
- when /^\d+\.\d+(?:e[-+]\d+)?$/
81
- value = value.to_f
73
+ elems.each_with_index do |elem,i|
74
+ if elem.include?(":") && !elems[i+1].include?(":")
75
+ value = elems[i+1]
76
+ case value
77
+ when /^\d+$/
78
+ value = value.to_i
79
+ when /^\d+\.\d+(?:e[-+]\d+)?$/
80
+ value = value.to_f
81
+ end
82
+ response[elem[0...-1].downcase.to_sym] = value
82
83
  end
83
- response[name.downcase.to_sym] = value
84
84
  end
85
85
  end
86
86
  else
data/myslog.gemspec CHANGED
@@ -12,6 +12,6 @@ Gem::Specification.new do |gem|
12
12
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
13
13
  gem.name = "myslog"
14
14
  gem.require_paths = ["lib"]
15
- gem.version = "0.0.8"
15
+ gem.version = "0.0.9"
16
16
  gem.add_development_dependency "rspec"
17
17
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myslog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
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: 2013-01-27 00:00:00.000000000 Z
12
+ date: 2013-03-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -70,3 +70,4 @@ summary: MySQL slow query parser.
70
70
  test_files:
71
71
  - spec/myslog.rb
72
72
  - spec/spec_helper.rb
73
+ has_rdoc: