nestedtext 4.4.4 → 4.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +5 -5
- data/lib/nestedtext/core_ext.rb +1 -1
- data/lib/nestedtext/decode.rb +2 -3
- data/lib/nestedtext/dumper.rb +5 -5
- data/lib/nestedtext/encode.rb +2 -1
- data/lib/nestedtext/version.rb +1 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22ac73186b0d9ba1785e2b84808b57345348a1e2a4cb9ca114b59062895664df
|
4
|
+
data.tar.gz: dfd5bf7254e65aecf7507bd7c43d084dd47e196dd84126f2c6fcb688dc70d53d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3e646f14b4e81fe9211b797deec8bce368438a2f9d980d1f1279f908be84928fbc033df5415a716e37e5c6ed7ed4a66c53941d645540e044680f0185f218497
|
7
|
+
data.tar.gz: 03c9c3f9242c1b749a4fc3ecdbd5c84ff6f4eff832a6c2272e8fe2af1188a8244566ebf383b4dfb0149a9008ec11322d5910f2634e79c70c0756f52da3813eae
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [4.5.0] - 2022-06-09
|
10
|
+
### Added
|
11
|
+
- Guard filesystem watch and test executor.
|
12
|
+
|
13
|
+
### Changed
|
14
|
+
- Dumped file content should end with newline, following updated version 3.3.0 of the NestedText specification.
|
15
|
+
|
16
|
+
## [4.4.6] - 2022-02-17
|
17
|
+
### Fixed
|
18
|
+
- rubydoc.info: don't force use hash value omission with rubycop. rubydoc.info is not on ruby 3.1 yet.
|
19
|
+
|
20
|
+
## [4.4.5] - 2022-02-17
|
21
|
+
### Fixed
|
22
|
+
- rubydoc.info: try remove unused module require.
|
23
|
+
|
9
24
|
## [4.4.4] - 2022-02-17
|
10
25
|
### Fixed
|
11
26
|
- rubydoc.info: revert reject instead of select
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/nestedtext.svg)](https://badge.fury.io/rb/nestedtext)
|
3
3
|
[![Gem Downloads](https://ruby-gem-downloads-badge.herokuapp.com/nestedtext?color=brightgreen&type=total&label=gem%20downloads)](https://rubygems.org/gems/nestedtext)
|
4
4
|
[![Documentation](https://img.shields.io/badge/docs-API-informational?logo=readthedocs&logoColor=violet)](https://www.rubydoc.info/gems/nestedtext/NestedText)
|
5
|
-
[![Data Format Version Supported](https://img.shields.io/badge/%F0%9F%84%BD%F0%9F%85%83%20Version%20Supported-3.
|
5
|
+
[![Data Format Version Supported](https://img.shields.io/badge/%F0%9F%84%BD%F0%9F%85%83%20Version%20Supported-3.3.0-blueviolet)](https://nestedtext.org/en/v3.3/)
|
6
6
|
[![Official Tests](https://img.shields.io/badge/Official%20Tests-Passing-success?logo=cachet)](https://github.com/KenKundert/nestedtext_tests/)
|
7
7
|
[![GitHub Actions: Continuous Integration](https://github.com/erikw/nestedtext-ruby/actions/workflows/ci.yml/badge.svg)](https://github.com/erikw/nestedtext-ruby/actions/workflows/ci.yml)
|
8
8
|
[![GitHub Actions: Continuous Deployment](https://github.com/erikw/nestedtext-ruby/actions/workflows/cd.yml/badge.svg)](https://github.com/erikw/nestedtext-ruby/actions/workflows/cd.yml)
|
@@ -19,9 +19,9 @@ A ruby library for the human friendly data format [NestedText](https://nestedtex
|
|
19
19
|
<!-- Use URL to hosted image, so that it shows up at rubydocs.info as well. Using relative image and yardoc option "--asset img:img" did not work. -->
|
20
20
|
<a href="#" ><img src="https://raw.githubusercontent.com/erikw/nestedtext-ruby/main/img/logo.webp" align="right" width="420px" alt="nestedtext-ruby logo" /></a>
|
21
21
|
|
22
|
-
Provided is support for decoding a NestedText file or string to Ruby data structures, as well as encoding Ruby objects to a NestedText file or string. Furthermore there is support for serialization and deserialization of custom classes. The supported language version of the data format can be
|
22
|
+
Provided is support for decoding a NestedText file or string to Ruby data structures, as well as encoding Ruby objects to a NestedText file or string. Furthermore there is support for serialization and deserialization of custom classes. The supported language version of the data format can be seen in the badge above. This implementation pass all the [official tests](https://github.com/KenKundert/nestedtext_tests).
|
23
23
|
|
24
|
-
This library is inspired Ruby stdlib modules `JSON` and `YAML` as well as the Python [reference implementation](https://github.com/KenKundert/nestedtext) of NestedText. Parsing is done with a LL(1) recursive descent parser and dumping with a recursive DFS traversal of the object references.
|
24
|
+
This library is inspired by Ruby's stdlib modules `JSON` and `YAML` as well as the Python [reference implementation](https://github.com/KenKundert/nestedtext) of NestedText. Parsing is done with a LL(1) recursive descent parser and dumping with a recursive DFS traversal of the object references.
|
25
25
|
|
26
26
|
To make this library practically useful, you should pair it with a [schema validator](#schema).
|
27
27
|
|
@@ -328,7 +328,6 @@ port_sum = servers.map { |server| server['port'] }.sum
|
|
328
328
|
|
329
329
|
|
330
330
|
# Development
|
331
|
-
|
332
331
|
1. Clone the repo
|
333
332
|
```console
|
334
333
|
$ git clone https://github.com/erikw/nestedtext-ruby.git && cd $(basename "$_" .git)
|
@@ -339,6 +338,7 @@ port_sum = servers.map { |server| server['port'] }.sum
|
|
339
338
|
1. You can also run `$ script/console` for an interactive prompt that will allow you to experiment.
|
340
339
|
1. For local testing, install the gem on local machine with: `$ bundle exec rake install`.
|
341
340
|
* or manually with `$ gem build *.gemscpec && gem install *.gem`
|
341
|
+
1. Watch changes on file system and execute tests with `$ bundle exec guard`.
|
342
342
|
|
343
343
|
|
344
344
|
Extra:
|
@@ -376,7 +376,7 @@ Just push a new semver tag and the workflow [cd.yml](.github/workflows/cd.yml) w
|
|
376
376
|
```console
|
377
377
|
$ vi -p lib/nestedtext/version.rb CHANGELOG.md
|
378
378
|
$ git commit -am "Prepare vX.Y.Z" && git push
|
379
|
-
$ git tag
|
379
|
+
$ git tag vX.Y.Z && git push --tags
|
380
380
|
```
|
381
381
|
|
382
382
|
or combined with gem-release:
|
data/lib/nestedtext/core_ext.rb
CHANGED
data/lib/nestedtext/decode.rb
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
require 'nestedtext/parser'
|
4
4
|
require 'nestedtext/errors_internal'
|
5
5
|
|
6
|
-
require 'logger'
|
7
6
|
require 'stringio'
|
8
7
|
|
9
8
|
module NestedText
|
@@ -19,7 +18,7 @@ module NestedText
|
|
19
18
|
def self.load(ntstring, top_class: Object, strict: false)
|
20
19
|
raise Errors::WrongInputTypeError.new([String], ntstring) unless ntstring.nil? || ntstring.is_a?(String)
|
21
20
|
|
22
|
-
Parser.new(StringIO.new(ntstring), top_class, strict:).parse
|
21
|
+
Parser.new(StringIO.new(ntstring), top_class, strict: strict).parse
|
23
22
|
end
|
24
23
|
|
25
24
|
# Decode a NestedText stored in a given file.
|
@@ -37,7 +36,7 @@ module NestedText
|
|
37
36
|
|
38
37
|
# Open explicitly in text mode to detect \r as line ending.
|
39
38
|
File.open(filename, 'rt') do |file|
|
40
|
-
Parser.new(file, top_class, strict:).parse
|
39
|
+
Parser.new(file, top_class, strict: strict).parse
|
41
40
|
end
|
42
41
|
end
|
43
42
|
end
|
data/lib/nestedtext/dumper.rb
CHANGED
@@ -84,13 +84,13 @@ module NestedText
|
|
84
84
|
def dump_any(obj, depth: 0, **kwargs)
|
85
85
|
trace_cycles(obj) do
|
86
86
|
case obj
|
87
|
-
when Hash then dump_hash(obj, depth
|
88
|
-
when Array then dump_array(obj, depth
|
89
|
-
when String then dump_string(obj, depth
|
87
|
+
when Hash then dump_hash(obj, depth: depth, **kwargs)
|
88
|
+
when Array then dump_array(obj, depth: depth, **kwargs)
|
89
|
+
when String then dump_string(obj, depth: depth, **kwargs)
|
90
90
|
when nil
|
91
|
-
@strict ? '' : dump_custom_class(nil, depth
|
91
|
+
@strict ? '' : dump_custom_class(nil, depth: depth, **kwargs)
|
92
92
|
else
|
93
|
-
dump_custom_class(obj, depth
|
93
|
+
dump_custom_class(obj, depth: depth, **kwargs)
|
94
94
|
end
|
95
95
|
end
|
96
96
|
end
|
data/lib/nestedtext/encode.rb
CHANGED
@@ -9,6 +9,7 @@ module NestedText
|
|
9
9
|
# @param obj [Object] The object to encode to NestedText.
|
10
10
|
# @param io [IO] Additionally write the output to this IO object.
|
11
11
|
# The caller is responsible for that the IO is closed after the call to this method.
|
12
|
+
# The file willl end with a newline.
|
12
13
|
# @param indentation [Integer] The indentation of nested levels to use.
|
13
14
|
# @param strict [Boolean] If strict mode should be used.
|
14
15
|
#
|
@@ -21,7 +22,7 @@ module NestedText
|
|
21
22
|
dumper = Dumper.new(indentation, strict)
|
22
23
|
result = dumper.dump obj
|
23
24
|
unless io.nil?
|
24
|
-
io.write(result)
|
25
|
+
io.write(result, "\n")
|
25
26
|
io.fsync
|
26
27
|
end
|
27
28
|
dumper.dump obj
|
data/lib/nestedtext/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nestedtext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Westrup
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unicode_utils
|
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
|
-
rubygems_version: 3.3.
|
111
|
+
rubygems_version: 3.3.7
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: A ruby library for the human friendly data format NestedText (https://nestedtext.org/)
|