troml 0.1.1 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Cargo.lock +48 -0
- data/Gemfile.lock +1 -1
- data/Rakefile +6 -0
- data/lib/troml/version.rb +1 -1
- data/lib/troml.rb +18 -1
- metadata +3 -4
- data/exe/troml +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8b32eb82d7b2bb7b0d366e435405248d3a1454e611ea3c4c00c8cb1c3532733
|
4
|
+
data.tar.gz: 22fe8c85fe18a4024cf64449eca7b25695e23cf816a38941bdef953d3541b6ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5385238a65243317cbf0b41be926281d04504714433c663ffadfcfa752a0c489db46543b5933c5f436411708cb723ab6ebaf1b889a05e1db5461c25113ac9201
|
7
|
+
data.tar.gz: dfac733d4b8c3cd5609317e5f0a5f0d7f46edad769ac0a01345827b77238c346d6eaa6fdedab7bbb1c2f14a28c79eb001a84fb1396e729ef8719fd8e51400d33
|
data/Cargo.lock
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
2
|
+
# It is not intended for manual editing.
|
3
|
+
version = 3
|
4
|
+
|
5
|
+
[[package]]
|
6
|
+
name = "lazy_static"
|
7
|
+
version = "1.4.0"
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
9
|
+
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
10
|
+
|
11
|
+
[[package]]
|
12
|
+
name = "libc"
|
13
|
+
version = "0.2.126"
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
15
|
+
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
|
16
|
+
|
17
|
+
[[package]]
|
18
|
+
name = "rutie"
|
19
|
+
version = "0.8.4"
|
20
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
21
|
+
checksum = "5d97db4cbb9739b48364c38cc9a6ebabdc07b42bd87b60ab448e1f29eaebb2ac"
|
22
|
+
dependencies = [
|
23
|
+
"lazy_static",
|
24
|
+
"libc",
|
25
|
+
]
|
26
|
+
|
27
|
+
[[package]]
|
28
|
+
name = "serde"
|
29
|
+
version = "1.0.137"
|
30
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
31
|
+
checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1"
|
32
|
+
|
33
|
+
[[package]]
|
34
|
+
name = "toml"
|
35
|
+
version = "0.5.9"
|
36
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
37
|
+
checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7"
|
38
|
+
dependencies = [
|
39
|
+
"serde",
|
40
|
+
]
|
41
|
+
|
42
|
+
[[package]]
|
43
|
+
name = "troml"
|
44
|
+
version = "0.1.0"
|
45
|
+
dependencies = [
|
46
|
+
"rutie",
|
47
|
+
"toml",
|
48
|
+
]
|
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
data/lib/troml/version.rb
CHANGED
data/lib/troml.rb
CHANGED
@@ -17,7 +17,24 @@ module Troml
|
|
17
17
|
class ExtParseError < Error; end
|
18
18
|
|
19
19
|
# Initialize external library
|
20
|
-
|
20
|
+
#
|
21
|
+
# This is a hack to work around the weirdness of developing
|
22
|
+
# a Rust extension while relying on Rubygems' native Cargo builder.
|
23
|
+
# Rubygems builds copies the shared object into the gem's lib directory
|
24
|
+
# when gem install is run, so it's available for loading in.
|
25
|
+
#
|
26
|
+
# However, while developing the gem, we want to be able to run the gem from its
|
27
|
+
# source context, so we rely on Rutie's convention of loading the shared object
|
28
|
+
# built by Cargo.
|
29
|
+
if File.exist?("troml.so")
|
30
|
+
# We are running in "installed" mode.
|
31
|
+
# Load the shared object built by rubygems.
|
32
|
+
require "troml.so"
|
33
|
+
else
|
34
|
+
# Otherwise we are running in "dev" mode.
|
35
|
+
# Load the target/release object via Rutie.
|
36
|
+
Rutie.new(:troml).init "Init_troml", __dir__
|
37
|
+
end
|
21
38
|
|
22
39
|
# Returns a hash representation of the TOML string passed.
|
23
40
|
# Raises on parse failure.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: troml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pawan Dubey
|
@@ -55,8 +55,7 @@ dependencies:
|
|
55
55
|
description: Blazing fast TOML parser, with the power of Rust.
|
56
56
|
email:
|
57
57
|
- git@pawandubey.com
|
58
|
-
executables:
|
59
|
-
- troml
|
58
|
+
executables: []
|
60
59
|
extensions:
|
61
60
|
- Cargo.toml
|
62
61
|
extra_rdoc_files: []
|
@@ -66,13 +65,13 @@ files:
|
|
66
65
|
- ".standard.yml"
|
67
66
|
- CHANGELOG.md
|
68
67
|
- CODE_OF_CONDUCT.md
|
68
|
+
- Cargo.lock
|
69
69
|
- Cargo.toml
|
70
70
|
- Gemfile
|
71
71
|
- Gemfile.lock
|
72
72
|
- LICENSE.txt
|
73
73
|
- README.md
|
74
74
|
- Rakefile
|
75
|
-
- exe/troml
|
76
75
|
- lib/troml.rb
|
77
76
|
- lib/troml/version.rb
|
78
77
|
- sig/troml.rbs
|
data/exe/troml
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "bundler/setup"
|
5
|
-
require "troml"
|
6
|
-
require "json"
|
7
|
-
|
8
|
-
def tag(val)
|
9
|
-
case val
|
10
|
-
when String
|
11
|
-
{type: "string", value: val}
|
12
|
-
when Integer
|
13
|
-
{type: "integer", value: val}
|
14
|
-
when Float
|
15
|
-
{type: "float", value: val}
|
16
|
-
when TrueClass, FalseClass
|
17
|
-
{type: "bool", value: val}
|
18
|
-
when Array
|
19
|
-
val.map { |e| tag(e) }
|
20
|
-
when Hash
|
21
|
-
val.transform_values { |v| tag(v) }
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
raw_toml = ARGF.read
|
26
|
-
|
27
|
-
parsed_toml = Troml.parse(raw_toml)
|
28
|
-
|
29
|
-
tagged_hash = tag(parsed_toml)
|
30
|
-
|
31
|
-
puts tagged_hash.to_json
|