sqm2json 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0205d1803db07b24a01d4f9f8f724558b1acd239563c37b28a03aa401a1df76
4
- data.tar.gz: 6de7251a1e81056f24c6cf6208d617ff29c2c001450c5c531a5fd84aa5d2591d
3
+ metadata.gz: 2954c708f8f44d64b934232c85de7c028f59b747ed5e89521a78a81be1f64969
4
+ data.tar.gz: 420534725aad6aaff137e976ca264af8e1be4ba6e7b28b16e571002dc944b3ba
5
5
  SHA512:
6
- metadata.gz: 1c38982487c1d5e2d92ff4f9d344ccb0b00400a5db9e5ac152fcb7dbdaf20449aae8f1e94926955d211d4b9553981d3bca7f1b704cdc914bc901e8c522b1de5e
7
- data.tar.gz: 74f81499454ea81c0f75e9008b36495c49ea9f66b2e9b13f60961eb5b059a49abc505cab94a573b6b297106daff881fbdc4960f4a0eacf9b877dd333596f8599
6
+ metadata.gz: 1f6235ed59b05c106c56858acc8355add681eaacf3748c1874a9d3a6065c2f4f4ba3b85854c43bd7af0f8b1f657d1eff2d3dc491948b796587a4f72886d879be
7
+ data.tar.gz: 6ad819ce7753daaa1c6dd60667edca7e72d3a788d3c0f8fbea62883a7984078e7c71a28264fce0cb4150a13e2cb8b9d065e833f82fe73ccb74a3d1e19e21dda8
@@ -6,7 +6,10 @@ module Sqm2Json
6
6
  # @param [String] sqm_document valid and readable mission.sqm file path
7
7
  # @return [Hash] JSON document
8
8
  def to_json(sqm_document)
9
- content = sqm_document.delete("\r\n").delete("\t")
9
+ content = sqm_document.gsub(/^[\s\S]*version = (\d\d);/,'version=\1;')
10
+ #content = content.gsub!(/\/\/.*\n/, '')
11
+ content = content.delete("\r\n").delete("\t")
12
+ content = content.gsub!(/\s*=\s*/,'=')
10
13
  content.gsub!(/(?<key>\w*)\s*=\s*(?<val>"");/, '\k<key>="ʉ";') # replace empty string values
11
14
  protect_special_chars_into_values(content)
12
15
  content.gsub!(/class (?<val>\w+)\s*\{/, '"\k<val>" : {')
@@ -16,7 +19,9 @@ module Sqm2Json
16
19
  content.gsub!(/,\}/, '}')
17
20
  content.gsub!(/\}[;,]\}/, '}}')
18
21
  recover_special_chars_into_values(content)
19
- ::JSON.parse("{#{content.chomp('"').chomp(',')}}", symbolize_names: true)
22
+ content = "{#{content.chomp('"').chomp(',')}}"
23
+ #puts content
24
+ ::JSON.parse(content, symbolize_names: true)
20
25
  end
21
26
 
22
27
  # Replace special characters into init-like fields before processing the structure
@@ -1,5 +1,5 @@
1
1
  module Sqm2Json
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
 
4
4
  def self.get_supported_versions
5
5
  [12, 51, 52, 54]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqm2json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas FLINOIS
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-27 00:00:00.000000000 Z
11
+ date: 2025-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler