immosquare-yaml 0.1.10 → 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: 4fd55f9ae0f4d9e13ef667a868df1670aa3a038860a8f2cb4db0e2f29dc08fa9
4
- data.tar.gz: bdf032155c8a4c9db6c0697c249c459378caaac8c46f00cf3d803d194a294dfb
3
+ metadata.gz: 573eadd9feb826e6365b2a86d74f224315a4cf04fae6636be0259587f4701da6
4
+ data.tar.gz: a8fe5672e271f2cf620a4d1f6091a4a3eb1be22dc8713b95568ed79c4d7b5927
5
5
  SHA512:
6
- metadata.gz: 3b8ed1227862217b4d7dca2011e4b8df8ca5ed20e8762d462ac2d4fbc062f295aaecf2f782d09405687f8d7ad09844b2ef3734ca8565814838db5739660674bb
7
- data.tar.gz: a2266c2e2b51e57715ae21ffd25c9391c9af2de021f702805271abad716261ad0ce6ece6cdd85d942725a627beeb610837c497a31bc3464f63111e5e754b445b
6
+ metadata.gz: 5ef47496ea01d662155006e97039e951b47fc601d1ec803293240b574e317f1e45821c2aa9e8c5e4baeb3a36ab8bd9ecbe362f4142a8cefb1718b1356e6af366
7
+ data.tar.gz: 766fc004a23ee4bc5bc6893492242d8029fa866faa1aa840963af12c1c49f26a2c8323e8805bf23aca68e3f3d716d7f6bbcd3206ea007eb867a073ba799aa980
@@ -1,3 +1,3 @@
1
1
  module ImmosquareYaml
2
- VERSION = "0.1.10".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
@@ -523,7 +531,7 @@ module ImmosquareYaml
523
531
  ## In YAML "inblock" scenarios, there's no need to add quotes
524
532
  ## around values as it's inherently handled.
525
533
  ## ============================================================ ##
526
- def clean_value(value, with_quotes_verif: true)
534
+ def clean_value(value, with_quotes_verif = true)
527
535
  ##============================================================##
528
536
  ## Convert value to string to prevent issues in subsequent operations
529
537
  ##============================================================##
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.10
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - IMMO SQUARE