nestedtext 1.1.1 → 1.2.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 +7 -3
- data/lib/nestedtext/core_ext_internal.rb +13 -0
- data/lib/nestedtext/decode.rb +0 -4
- data/lib/nestedtext/dumper.rb +3 -7
- data/lib/nestedtext/errors.rb +0 -1
- data/lib/nestedtext/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42f5f6f0ac6182999d4036976103b740552796029ffe77749a8cdf5d0d8d0167
|
4
|
+
data.tar.gz: c06dd5613b6c5296398a838e2419dd2addaf34b9712a1baec36ecd23e5d4c6f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dc821033f7813441756fcfb04e9b6a442993130462ff2572c7401b634149b538be4a831a7deb5fdb91a432be5f795d37b473fc6ac4dad5eb1e8b9c88762a5f9
|
7
|
+
data.tar.gz: ba7d69e4bfb3929c5dd5e0f037e88b7b13fac466aa011bccacf8095812f990c1e32b8c449df721514414cc8ce0b1c6f11723644cce13a5ee4330f549c793ee56
|
data/CHANGELOG.md
CHANGED
@@ -6,19 +6,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [1.2.0] - 2022-01-25
|
10
|
+
### Changed
|
11
|
+
- Hide core extension `String.normalize_line_endings` from users.
|
12
|
+
|
9
13
|
## [1.1.1] - 2022-01-25
|
10
14
|
### Fixed
|
11
15
|
- Renamed `NTEncodeMixing` to `NTEncodeMixin` .
|
12
16
|
|
13
17
|
## [1.1.0] - 2022-01-25
|
14
18
|
### Added
|
15
|
-
- Expose `NestedText::VERSION` for convenience to the
|
19
|
+
- Expose `NestedText::VERSION` for convenience to the users.
|
16
20
|
|
17
21
|
## [1.0.0] - 2022-01-25
|
18
|
-
The library is now useful for
|
22
|
+
The library is now useful for users!
|
19
23
|
|
20
24
|
### Changed
|
21
|
-
- Hide all internals in the module from
|
25
|
+
- Hide all internals in the module from users.
|
22
26
|
|
23
27
|
## [0.6.0] - 2022-01-24
|
24
28
|
### Fixed
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module NestedText
|
2
|
+
# Hiding extensions for Kernel here away from clients.
|
3
|
+
# Reference: https://ruby-doc.org/core-3.1.0/doc/syntax/refinements_rdoc.html
|
4
|
+
module CoreExtInternal
|
5
|
+
refine String do
|
6
|
+
def normalize_line_endings
|
7
|
+
# windows/mac -> unix
|
8
|
+
gsub(/\r\n?/, "\n")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
private_constant :CoreExtInternal
|
13
|
+
end
|
data/lib/nestedtext/decode.rb
CHANGED
@@ -8,10 +8,6 @@ require "stringio"
|
|
8
8
|
|
9
9
|
module NestedText
|
10
10
|
def self.load(ntstring, top_class: Object, strict: true)
|
11
|
-
# logger = Logger.new(STDOUT) # TODO: make this available to other classes in module. How avoid singleton?
|
12
|
-
# logger.info "input=#{raw_input_string}"
|
13
|
-
# logger.info "top=#{top}"
|
14
|
-
|
15
11
|
raise Errors::WrongInputTypeError.new([String], ntstring) unless ntstring.nil? || ntstring.is_a?(String)
|
16
12
|
|
17
13
|
Parser.new(StringIO.new(ntstring), top_class, strict: strict).parse
|
data/lib/nestedtext/dumper.rb
CHANGED
@@ -1,12 +1,8 @@
|
|
1
|
-
|
2
|
-
class String
|
3
|
-
def normalize_line_endings
|
4
|
-
# windows/mac -> unix
|
5
|
-
gsub(/\r\n?/, "\n")
|
6
|
-
end
|
7
|
-
end
|
1
|
+
require "nestedtext/core_ext_internal"
|
8
2
|
|
9
3
|
module NestedText
|
4
|
+
using NestedText.const_get(:CoreExtInternal)
|
5
|
+
|
10
6
|
class Dumper
|
11
7
|
def initialize(opts = EncodeOptions.new)
|
12
8
|
@indentation = opts.indentation
|
data/lib/nestedtext/errors.rb
CHANGED
@@ -7,7 +7,6 @@ require "nestedtext/constants"
|
|
7
7
|
|
8
8
|
module NestedText
|
9
9
|
# Top level error for clients to rescue on.
|
10
|
-
# TODO hide #new so that client's cant create instance of it. Unit test this. https://ruby-doc.org/core-3.1.0/Module.html#private_class_method-method
|
11
10
|
class Error < StandardError
|
12
11
|
private_class_method :new
|
13
12
|
end
|
data/lib/nestedtext/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nestedtext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Westrup
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- lib/nestedtext.rb
|
64
64
|
- lib/nestedtext/constants.rb
|
65
65
|
- lib/nestedtext/core_ext.rb
|
66
|
+
- lib/nestedtext/core_ext_internal.rb
|
66
67
|
- lib/nestedtext/decode.rb
|
67
68
|
- lib/nestedtext/dumper.rb
|
68
69
|
- lib/nestedtext/encode.rb
|