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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75a2d51a9136b92dfc3ca5c7d41172107a51ec9d330b0553c992a86d32156179
4
- data.tar.gz: b28add9673b21617c99fe4573794c44ee04a0c49c003ced761540fab4f4b1a55
3
+ metadata.gz: 42f5f6f0ac6182999d4036976103b740552796029ffe77749a8cdf5d0d8d0167
4
+ data.tar.gz: c06dd5613b6c5296398a838e2419dd2addaf34b9712a1baec36ecd23e5d4c6f9
5
5
  SHA512:
6
- metadata.gz: 7f7147ac293908f5cf6aa67175f0a0bf5f0b0dbc68fda541c58e045edbba88e176cd1dffd8e18004fa8848f385c62ae8df1124d8c60afca8ac47231b54cb50bb
7
- data.tar.gz: 00b93d7103d7a8aee1c4c4902ff5a935ceb0760265a776ad837a845b8992869f47b704dfed4cdd6c7788df567f64ab0d936494ef52bfff15302c8693f3f045cd
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 clients.
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 clients!
22
+ The library is now useful for users!
19
23
 
20
24
  ### Changed
21
- - Hide all internals in the module from clients.
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
@@ -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
@@ -1,12 +1,8 @@
1
- # TODO: is this exposed to client who import this file? If so, hide it!
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
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NestedText
4
- VERSION = "1.1.1"
4
+ VERSION = "1.2.0"
5
5
  end
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.1.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