tomlrb 1.2.4 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -8
- data/benchmarks/bench.rb +2 -2
- data/lib/tomlrb.rb +5 -1
- data/lib/tomlrb/scanner.rb +1 -1
- data/lib/tomlrb/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be502b2a9974d26ce6fd6b03288086b2aedbbffd
|
4
|
+
data.tar.gz: 0a8e50b7800a3e6ab2f69decb26978c2013db0a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20ddd92f583df5e8eaa30359f44bcb78979b2bce0046992475db6256d15a6ff81babdc5f07841ad7f6ee8dc6466de9abb8b486ea38dd7e279fb43fb460dc826a
|
7
|
+
data.tar.gz: 39f8154cbae5943b80ceedc1648ec5c95bd6bb71766aa8e836fd1be5a56bce7b69e161682f946d74d85e02539de94f19b1b3eed6089d9aee48fe40bfcd4725db
|
data/README.md
CHANGED
@@ -45,17 +45,16 @@ You can run the benchmark against the only other v0.4.0 compliant parser to my k
|
|
45
45
|
Here are the results on my machine:
|
46
46
|
|
47
47
|
```
|
48
|
-
|
48
|
+
Warming up --------------------------------------
|
49
49
|
emancu/toml-rb 1.000 i/100ms
|
50
|
-
fbernier/tomlrb
|
51
|
-
|
52
|
-
emancu/toml-rb
|
53
|
-
fbernier/tomlrb
|
50
|
+
fbernier/tomlrb 65.000 i/100ms
|
51
|
+
Calculating -------------------------------------
|
52
|
+
emancu/toml-rb 19.199 (± 5.2%) i/s - 96.000 in 5.034377s
|
53
|
+
fbernier/tomlrb 653.650 (± 4.0%) i/s - 3.315k in 5.081117s
|
54
54
|
|
55
55
|
Comparison:
|
56
|
-
fbernier/tomlrb:
|
57
|
-
emancu/toml-rb:
|
58
|
-
|
56
|
+
fbernier/tomlrb: 653.6 i/s
|
57
|
+
emancu/toml-rb: 19.2 i/s - 34.05x slower
|
59
58
|
```
|
60
59
|
|
61
60
|
## Development
|
data/benchmarks/bench.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'benchmark/ips'
|
2
2
|
require_relative '../lib/tomlrb'
|
3
3
|
begin
|
4
|
-
require 'toml'
|
4
|
+
require 'toml-rb'
|
5
5
|
rescue LoadError
|
6
6
|
puts "Install toml-rb using 'gem install toml-rb' first."
|
7
7
|
end
|
@@ -11,7 +11,7 @@ data = File.read(File.join(__dir__, '../test/example-v0.4.0.toml'))
|
|
11
11
|
Benchmark.ips do |x|
|
12
12
|
|
13
13
|
x.report("emancu/toml-rb") do
|
14
|
-
|
14
|
+
TomlRB.parse(data)
|
15
15
|
end
|
16
16
|
|
17
17
|
x.report("fbernier/tomlrb") do
|
data/lib/tomlrb.rb
CHANGED
@@ -35,6 +35,10 @@ module Tomlrb
|
|
35
35
|
# @option options [Boolean] :symbolize_keys (false) whether to return the keys as symbols or strings
|
36
36
|
# @return [Hash] the Ruby data structure represented by the input
|
37
37
|
def self.load_file(path, **options)
|
38
|
-
|
38
|
+
# By default Ruby sets the external encoding of an IO object to the
|
39
|
+
# default external encoding. The default external encoding is set by
|
40
|
+
# locale encoding or the interpreter -E option.
|
41
|
+
tmp = File.read(path, :encoding=>'utf-8')
|
42
|
+
Tomlrb.parse(tmp, options)
|
39
43
|
end
|
40
44
|
end
|
data/lib/tomlrb/scanner.rb
CHANGED
@@ -11,7 +11,7 @@ module Tomlrb
|
|
11
11
|
STRING_LITERAL_MULTI = /'{3}([\s\S]*?'{3})/m
|
12
12
|
DATETIME = /(-?\d{4})-(\d{2})-(\d{2})(?:(?:t|\s)(\d{2}):(\d{2}):(\d{2}(?:\.\d+)?))?(z|[-+]\d{2}:\d{2})?/i
|
13
13
|
FLOAT = /[+-]?(?:[0-9_]+\.[0-9_]*|\.[0-9_]+|\d+(?=[eE]))(?:[eE][+-]?[0-9_]+)?/
|
14
|
-
INTEGER = /[+-]?\d(_?\d)
|
14
|
+
INTEGER = /[+-]?\d(_?\d)*(?![A-Za-z0-9_-]+)/
|
15
15
|
TRUE = /true/
|
16
16
|
FALSE = /false/
|
17
17
|
|
data/lib/tomlrb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tomlrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francois Bernier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A racc based toml parser
|
14
14
|
email:
|
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
56
|
version: '0'
|
57
57
|
requirements: []
|
58
58
|
rubyforge_project:
|
59
|
-
rubygems_version: 2.
|
59
|
+
rubygems_version: 2.5.2.1
|
60
60
|
signing_key:
|
61
61
|
specification_version: 4
|
62
62
|
summary: A racc based toml parser
|