immosquare-yaml 0.1.19 → 0.1.20

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: 680ddbc42c31c133c3c940c9d0b340f16c8723ec7d43d71441ea07588cdb35f4
4
- data.tar.gz: c56e70e885e55a91847ef655dc009b97c902d75e3ff555bffc0e2e667f018c38
3
+ metadata.gz: 467e395c6883993cd3a7496ca196e0aae40fc5b0b51159e8710b3b852cc8857f
4
+ data.tar.gz: b066518248c9f75656bc6fc880f14d82a78aae511272f353df7319ec2ec69bdd
5
5
  SHA512:
6
- metadata.gz: 41278873f50fffd5892eebf4a683e48a0f169dd543ad1248926f0bc2f0db7e9bac67d51ebe19ed7b66dc33191de176627838a092d8a397c09d96e5d99939f80d
7
- data.tar.gz: d26c47090db57e611afac463db2a01a633c4db16ca8de6207db41411c522886ea08de1996e57989fa64eddd62ec9d7bca257aaa268db417e00e855dc8e003ed2
6
+ metadata.gz: 64b828a55553839f8baa4f3da05ce2f2d7f7b6ef1d9a3340cf413467e27337db80b142ac7ae52742a74107175d7baa169e1fd7eab21d383b94888b2f754fd1ba
7
+ data.tar.gz: 7583b3bc085e7c25808cc4a0caec2b03cdd825929d7e79aa365b494a4546afbb0f9c3d393500c346fd640a4728e6f98abd70be21d948ce695e5efc0d82311c0b
@@ -1,3 +1,3 @@
1
1
  module ImmosquareYaml
2
- VERSION = "0.1.19".freeze
2
+ VERSION = "0.1.20".freeze
3
3
  end
@@ -240,48 +240,7 @@ module ImmosquareYaml
240
240
 
241
241
  private
242
242
 
243
- ##===========================================================================##
244
- ## This method ensures the file ends with a single newline, facilitating
245
- ## cleaner multi-line blocks. It operates by reading all lines of the file,
246
- ## removing any empty lines at the end, and then appending a newline.
247
- ## This guarantees the presence of a newline at the end, and also prevents
248
- ## multiple newlines from being present at the end.
249
- ##
250
- ## Params:
251
- ## +file_path+:: The path to the file to be normalized.
252
- ##
253
- ## Returns:
254
- ## The total number of lines in the normalized file.
255
- ##===========================================================================##
256
- def normalize_last_line(file_path)
257
- end_of_line = $INPUT_RECORD_SEPARATOR
258
- ##============================================================##
259
- ## Read all lines from the file
260
- ## https://gist.github.com/guilhermesimoes/d69e547884e556c3dc95
261
- ##============================================================##
262
- content = File.read(file_path)
263
-
264
243
 
265
- ##===========================================================================##
266
- ## Remove all trailing empty lines at the end of the file
267
- ##===========================================================================##
268
- content.gsub!(/#{Regexp.escape(end_of_line)}+\z/, "")
269
-
270
- ##===========================================================================##
271
- ## Append an EOL at the end to maintain the file structure
272
- ##===========================================================================##
273
- content << end_of_line
274
-
275
- ##===========================================================================##
276
- ## Write the modified lines back to the file
277
- ##===========================================================================##
278
- File.write(file_path, content)
279
-
280
- ##===========================================================================##
281
- ## Return the total number of lines in the modified file
282
- ##===========================================================================##
283
- content.lines.size
284
- end
285
244
 
286
245
  ##============================================================##
287
246
  ## Deeply cleans the specified YAML file
@@ -299,7 +258,7 @@ module ImmosquareYaml
299
258
  ## This also allows us to get the total number of lines in the file,
300
259
  ## helping us to determine when we are processing the last line
301
260
  ###===================================================================================#
302
- line_count = normalize_last_line(file_path)
261
+ line_count = File.normalize_last_line(file_path)
303
262
 
304
263
 
305
264
  File.foreach(file_path) do |current_line|
@@ -802,7 +761,7 @@ module ImmosquareYaml
802
761
  deep_transform_values(nested_hash) do |value|
803
762
  if value.is_a?(Array) && !value[0].nil? && value[0].instance_of?(String) && value[0].start_with?(CUSTOM_SEPARATOR) && value[0].end_with?(CUSTOM_SEPARATOR)
804
763
  style_type = value[0].gsub(CUSTOM_SEPARATOR, NOTHING)
805
- indent_supp = style_type.scan(/\d+/).first&.to_i || 0
764
+ indent_supp = style_type.scan(/\d+/).first.to_i
806
765
  indent_supp = [indent_supp - INDENT_SIZE, 0].max
807
766
  value[1] = value[1].map {|l| "#{SPACE * indent_supp}#{l}" }
808
767
  text = value[1].join(NEWLINE)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: immosquare-yaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.19
4
+ version: 0.1.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - IMMO SQUARE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-10 00:00:00.000000000 Z
11
+ date: 2024-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '0'
34
34
  - - ">="
35
35
  - !ruby/object:Gem::Version
36
- version: 0.1.11
36
+ version: 0.1.13
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 0.1.11
46
+ version: 0.1.13
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: iso-639
49
49
  requirement: !ruby/object:Gem::Requirement