logfmt 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ee31ce93089f77a986eeaf421bc81109629096a
4
- data.tar.gz: cc396ac537f202d1b5a1422b068c19abdef6cf67
3
+ metadata.gz: 12311fc6d8f64e7c703b4d5ef3494ef51df9ad56
4
+ data.tar.gz: 8a3aa8fe3253121859df2c19eda8281e6dd2b599
5
5
  SHA512:
6
- metadata.gz: f5846e36d0e21b576156ee0c8ef0ef94c503b50279807e734f5aaf6d4351f9f61946d0e51e99f8a545a85f81f5f7ac93f7971bfa069e99dc9a4acd70da5372ed
7
- data.tar.gz: ef739d7f6a37e95ac60ab94ca1356f90e5e6133682603dd0ae7d87bddfdb08b4bfe5b3ab9bfb6eb91d4447a1569ad42499f4fc12ee3f258a7c1a46759529e1cc
6
+ metadata.gz: 845a530e2620fcf4eccabe54f715be1742cbe62996fbdb0ea020634fa9f21533620d44fd726921bc631980b89d28a615d604f647b45c1a770cf440520cea9939
7
+ data.tar.gz: 44c635fb1d2f7649821ebc15777acfca429246b9fe99c97ae686e3216f77132759e0baba61f9baf7b28d6d42a47ed647d18c5b65680595ccc23c271a1a56a259
@@ -1,4 +1,3 @@
1
-
2
1
  module Logfmt
3
2
  GARBAGE = 0
4
3
  KEY = 1
@@ -57,7 +56,12 @@ module Logfmt
57
56
  state = GARBAGE
58
57
  end
59
58
  if i >= line.length
60
- output[key.strip()] = true
59
+ if integer?(value)
60
+ value = Integer(value)
61
+ elsif numeric?(value)
62
+ value = Float(value)
63
+ end
64
+ output[key.strip()] = value || true
61
65
  end
62
66
  next
63
67
  end
@@ -1,3 +1,3 @@
1
1
  module Logfmt
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -17,7 +17,6 @@ Gem::Specification.new do |gem|
17
17
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
19
  gem.require_paths = ["lib"]
20
- gem.add_dependency "parslet", "~> 1.5"
21
- gem.add_development_dependency "rspec", "~> 2.14"
22
- gem.add_development_dependency "rake", "~> 10.1"
20
+ gem.add_development_dependency "rspec", "~> 3.0"
21
+ gem.add_development_dependency "rake", "~> 10.3"
23
22
  end
@@ -126,4 +126,9 @@ describe Logfmt do
126
126
  expect(data["key"].class).to eq(String)
127
127
  end
128
128
 
129
+ it 'parse last as integer type' do
130
+ data = Logfmt.parse('key1=4 key2=9')
131
+ expect(data["key1"]).to eq(4)
132
+ expect(data["key2"]).to eq(9)
133
+ end
129
134
  end
@@ -5,7 +5,6 @@
5
5
  #
6
6
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
7
  RSpec.configure do |config|
8
- config.treat_symbols_as_metadata_keys_with_true_values = true
9
8
  config.run_all_when_everything_filtered = true
10
9
  config.filter_run :focus
11
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logfmt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timothée Peignier
@@ -10,48 +10,34 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2014-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: parslet
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.5'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.5'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rspec
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - "~>"
32
18
  - !ruby/object:Gem::Version
33
- version: '2.14'
19
+ version: '3.0'
34
20
  type: :development
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
24
  - - "~>"
39
25
  - !ruby/object:Gem::Version
40
- version: '2.14'
26
+ version: '3.0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: rake
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - "~>"
46
32
  - !ruby/object:Gem::Version
47
- version: '10.1'
33
+ version: '10.3'
48
34
  type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
38
  - - "~>"
53
39
  - !ruby/object:Gem::Version
54
- version: '10.1'
40
+ version: '10.3'
55
41
  description: Parse log lines in the logfmt style.
56
42
  email:
57
43
  - timothee.peignier@tryphon.org
@@ -99,3 +85,4 @@ summary: Parse logfmt messages.
99
85
  test_files:
100
86
  - spec/logfmt/parser_spec.rb
101
87
  - spec/spec_helper.rb
88
+ has_rdoc: