immosquare-extensions 0.1.15 → 0.1.17

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: 9eac5ff3164cb73f659292ba3a389b9213f647e5c5c54f9da0c6535ec68ca573
4
- data.tar.gz: e1bc371e64193f0d4750298aa0c5e18a88827caa5c2d4826885a8caa530f4ccd
3
+ metadata.gz: 65ca43ea6bda3e92d7fa0a419a34029f0856f4687d030b1f4ae142197525ef2c
4
+ data.tar.gz: d6d16a447632fed299569d3b1b9eebf8cffbe8e1b307a38f20a5e91d66dd82f2
5
5
  SHA512:
6
- metadata.gz: 734f2700c95e499f2a4fa35f7b7b7fc80f81aac58d5480332db03490919b5cec8fad77355cc9d5014c21b613144eca10981818422420fe64a54dc4ff5bb210ef
7
- data.tar.gz: a8076f8d899a9fa2bb6b54b09e15c2b6674f59141fc1d4d17e90e481f9de7c362fef9ffa5ebc0b9d7b7c55aeebc28a5ee338c0dad1d5775cfceb7d87a7304297
6
+ metadata.gz: 2ff64eaa5656fa0bc8e0052ca3fba24b16158d7a0498b753ed8756118718d5fb8520f4eeb615da0b91824b1246dc96259698ead7ef42cbd9601d2b1b3227fccd
7
+ data.tar.gz: 9a3e6d9d6149efc1ba1667feb892784209d791f7fc308b092e0382e9ccebbbd95435a9510ff1b66a6330ec2d120de26bcd56b902712d2af7de33119d83b6b7db
@@ -33,7 +33,7 @@ class File
33
33
  ## Read the content of the file with the detected encoding,
34
34
  ## falling back to UTF-8 if the detected encoding is empty or invalid.
35
35
  ##============================================================##
36
- detected_encoding = `uchardet #{file_path}`.strip
36
+ detected_encoding = `uchardet #{file_path}`.strip.to_s.upcase
37
37
  encoding_whitelist = [
38
38
  "UTF-8", # Encodage universel pour texte avec ou sans accents
39
39
  "Windows-1252", # Utilisé couramment pour les langues occidentales
@@ -64,7 +64,8 @@ class File
64
64
  "UTF-16BE", # UTF-16 Big Endian
65
65
  "UTF-32LE", # UTF-32 Little Endian
66
66
  "UTF-32BE" # UTF-32 Big Endian
67
- ]
67
+ ].map(&:upcase)
68
+
68
69
 
69
70
 
70
71
  encoding_to_use = detected_encoding.empty? || !encoding_whitelist.include?(detected_encoding) ? "UTF-8" : "#{detected_encoding}:UTF-8"
@@ -7,11 +7,17 @@ module ImmosquareExtensions
7
7
  ##============================================================##
8
8
  def json_representation(value, align, indent_size, indent)
9
9
  case value
10
- when Hash, Array then dump_beautify_json(value, align, indent_size, indent + indent_size)
11
- when String then "\"#{value}\""
12
- when NilClass then "null"
13
- when TrueClass, FalseClass then value.to_s
14
- else value
10
+ when Hash, Array
11
+ dump_beautify_json(value, align, indent_size, indent + indent_size)
12
+ when String
13
+ escaped_value = value.gsub("\n", "\\n").gsub("\r", "\\r")
14
+ "\"#{escaped_value}\""
15
+ when NilClass
16
+ "null"
17
+ when TrueClass, FalseClass
18
+ value.to_s
19
+ else
20
+ value.to_s
15
21
  end
16
22
  end
17
23
 
@@ -1,3 +1,3 @@
1
1
  module ImmosquareExtensions
2
- VERSION = "0.1.15".freeze
2
+ VERSION = "0.1.17".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: immosquare-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - IMMO SQUARE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-05 00:00:00.000000000 Z
11
+ date: 2024-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unicode_utils