toml-rb 2.1.0 → 2.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd9c5ba72f17c7f6c080cab4a3f67c478f63cc7660da4962dff12f06ce9abc8f
4
- data.tar.gz: adc7291b56ea5a442efe533808f8b7fcfe05494c55f73dc554f5ec0e8bb22769
3
+ metadata.gz: 765a560c972358ce8b26fd4c2a1206f3605cd981d34cc95ce76e8883c74db0ce
4
+ data.tar.gz: ceb2f71af612e83e62c33a27ea947144b76e900883eef1200cb6eb2d416f7426
5
5
  SHA512:
6
- metadata.gz: a8be2fbd9046868aee722f5edf17451966be58bce14d1c7cc693a7ff3d1735c461b96a769720a3fa599a8e9de649e451dd8b7d2a9cc179122a50b8a3222cfc55
7
- data.tar.gz: aa7de16365bf67d983f1aed345e6ed90614209acd6663b525d9ba6621e39283d9e6312a12607e2c60bfb3205b198502cefe15e390eda6b229cef0f9dddfdd9bb
6
+ metadata.gz: 66cf777cc7be8677ba2feaf63a0521a3d578f2482d5bbf63908f2fc10424a213fcd8080a83eab73fcdb954f9e0645bb11ddb6fcb01f2f6121f512aae1606e147
7
+ data.tar.gz: 13b9908f48b5888487e9417d8b3eff1c7388e3e8b7e0a031ad0045142be2210ba6ba72252da5e7c79ed6c4faf26c6cf51128f343b72ef5483e969cc51b688268
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ![TOML Logo](https://github.com/toml-lang/toml/blob/master/logos/toml-100.png)
1
+ ![TOML Logo](https://github.com/toml-lang/toml/blob/main/logos/toml-100.png)
2
2
 
3
3
 
4
4
  toml-rb
@@ -11,7 +11,7 @@ toml-rb
11
11
 
12
12
  A [TOML](https://github.com/toml-lang/toml) parser using [Citrus](http://mjackson.github.io/citrus) library.
13
13
 
14
- TOML specs supported: `0.5.0`
14
+ TOML specs supported: `1.0.0`
15
15
 
16
16
  Installation
17
17
  ------------
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "date"
2
4
 
3
5
  module TomlRB
@@ -53,7 +55,7 @@ module TomlRB
53
55
  def dump_simple_pairs(simple_pairs)
54
56
  simple_pairs.each do |key, val|
55
57
  key = quote_key(key) unless bare_key? key
56
- @toml_str << "#{key} = #{to_toml(val)}\n"
58
+ @toml_str += "#{key} = #{to_toml(val)}\n"
57
59
  end
58
60
  end
59
61
 
@@ -91,10 +93,12 @@ module TomlRB
91
93
  obj.strftime("%Y-%m-%dT%H:%M:%SZ")
92
94
  elsif obj.is_a?(Date)
93
95
  obj.strftime("%Y-%m-%d")
94
- elsif obj.is_a? Regexp
96
+ elsif obj.is_a?(Regexp)
95
97
  obj.inspect.inspect
96
- elsif obj.is_a? String
98
+ elsif obj.is_a?(String)
97
99
  obj.inspect.gsub(/\\(#[$@{])/, '\1')
100
+ elsif obj.is_a?(Array)
101
+ "[" + obj.map(&method(:to_toml)).join(", ") + "]"
98
102
  else
99
103
  obj.inspect
100
104
  end
@@ -1,36 +1,36 @@
1
1
  grammar TomlRB::Arrays
2
2
  include TomlRB::Primitive
3
-
3
+
4
4
  rule array_comments
5
5
  (indent? (comment indent?)*)
6
6
  end
7
7
 
8
8
  rule float_array
9
- (float (space "," array_comments float)*) {
9
+ (float (indent? "," array_comments float)*) {
10
10
  captures[:float].map(&:value)
11
11
  }
12
12
  end
13
13
 
14
14
  rule string_array
15
- (string (space "," array_comments string)*) {
15
+ (string (indent? "," array_comments string)*) {
16
16
  captures[:string].map(&:value)
17
17
  }
18
18
  end
19
19
 
20
20
  rule integer_array
21
- (integer (space "," array_comments integer)*) {
21
+ (integer (indent? "," array_comments integer)*) {
22
22
  captures[:integer].map(&:value)
23
23
  }
24
24
  end
25
25
 
26
26
  rule datetime_array
27
- (datetime (space "," array_comments datetime)*) {
27
+ (datetime (indent? "," array_comments datetime)*) {
28
28
  captures[:datetime].map(&:value)
29
29
  }
30
30
  end
31
31
 
32
32
  rule bool_array
33
- (bool (space "," array_comments bool)*) {
33
+ (bool (indent? "," array_comments bool)*) {
34
34
  captures[:bool].map(&:value)
35
35
  }
36
36
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TomlRB
4
- VERSION = "2.1.0"
4
+ VERSION = "2.2.0"
5
5
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toml-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emiliano Mancuso
8
8
  - Lucas Tolchinsky
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-11-01 00:00:00.000000000 Z
12
+ date: 2022-07-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: citrus
@@ -103,7 +103,7 @@ homepage: https://github.com/emancu/toml-rb
103
103
  licenses:
104
104
  - MIT
105
105
  metadata: {}
106
- post_install_message:
106
+ post_install_message:
107
107
  rdoc_options: []
108
108
  require_paths:
109
109
  - lib
@@ -118,8 +118,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  requirements: []
121
- rubygems_version: 3.2.30
122
- signing_key:
121
+ rubygems_version: 3.2.9
122
+ signing_key:
123
123
  specification_version: 4
124
124
  summary: Toml parser in ruby, for ruby.
125
125
  test_files: []