immosquare-yaml 0.1.11 → 0.1.12

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: 233ee6e552c634b6fb640a401882a01deb01f114f63ad3abdd3822e00c1895a8
4
- data.tar.gz: 8e998672d8c72a2894e78d93eebf2dfdc8c6c4df892e0a1c4834399d4961d39f
3
+ metadata.gz: 573eadd9feb826e6365b2a86d74f224315a4cf04fae6636be0259587f4701da6
4
+ data.tar.gz: a8fe5672e271f2cf620a4d1f6091a4a3eb1be22dc8713b95568ed79c4d7b5927
5
5
  SHA512:
6
- metadata.gz: 3d089b20cfa08b4f73c5bf0483a01aea667104a5745c4cc4e8fca96200c9453efa271b192b3f0b6701edd4c105e69b8620fa7a39cd7cd92e8eb590a98d81d101
7
- data.tar.gz: 07eaaf3c64d95808a28b8dc10f413ea18c18429878a980e5456b3e6779f6969b44d41770fbf413bdd51b9b131bc30a3c4c537f18737fcd9f9e89efb469021b44
6
+ metadata.gz: 5ef47496ea01d662155006e97039e951b47fc601d1ec803293240b574e317f1e45821c2aa9e8c5e4baeb3a36ab8bd9ecbe362f4142a8cefb1718b1356e6af366
7
+ data.tar.gz: 766fc004a23ee4bc5bc6893492242d8029fa866faa1aa840963af12c1c49f26a2c8323e8805bf23aca68e3f3d716d7f6bbcd3206ea007eb867a073ba799aa980
@@ -1,3 +1,3 @@
1
1
  module ImmosquareYaml
2
- VERSION = "0.1.11".freeze
2
+ VERSION = "0.1.12".freeze
3
3
  end
@@ -1,9 +1,15 @@
1
+ require "English"
1
2
  require_relative "immosquare-yaml/configuration"
2
3
  require_relative "immosquare-yaml/shared_methods"
3
4
  require_relative "immosquare-yaml/translate"
4
5
  require_relative "immosquare-yaml/railtie" if defined?(Rails)
5
6
 
6
-
7
+ ##===========================================================================##
8
+ ## Importing the 'English' library allows us to use more human-readable
9
+ ## global variables, such as $INPUT_RECORD_SEPARATOR instead of $/,
10
+ ## which enhances code clarity and makes it easier to understand
11
+ ## the purpose of these variables in our code.
12
+ ##===========================================================================##
7
13
  module ImmosquareYaml
8
14
  extend SharedMethods
9
15
 
@@ -222,21 +228,23 @@ module ImmosquareYaml
222
228
  ## The total number of lines in the normalized file.
223
229
  ##===========================================================================##
224
230
  def normalize_last_line(file_path)
231
+ end_of_line = $INPUT_RECORD_SEPARATOR
225
232
  ##============================================================##
226
233
  ## Read all lines from the file
227
234
  ## https://gist.github.com/guilhermesimoes/d69e547884e556c3dc95
228
235
  ##============================================================##
229
236
  content = File.read(file_path)
230
237
 
238
+
231
239
  ##===========================================================================##
232
240
  ## Remove all trailing empty lines at the end of the file
233
- content.gsub!(/#{Regexp.escape($INPUT_RECORD_SEPARATOR)}+\z/, "")
234
241
  ##===========================================================================##
242
+ content.gsub!(/#{Regexp.escape(end_of_line)}+\z/, "")
235
243
 
236
244
  ##===========================================================================##
237
- ## Append a newline at the end to maintain the file structure
238
- ###===========================================================================##
239
- content += $INPUT_RECORD_SEPARATOR
245
+ ## Append an EOL at the end to maintain the file structure
246
+ ##===========================================================================##
247
+ content << end_of_line
240
248
 
241
249
  ##===========================================================================##
242
250
  ## Write the modified lines back to the file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: immosquare-yaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - IMMO SQUARE