modl 0.3.20 → 0.3.21

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: '00617859c13359189d14d838eb6701f4a755f3933631e7771c664751e1779651'
4
- data.tar.gz: 46967560c08f4eb541553bc184e0688040e91f5e3513da6709d316dae74b7f4a
3
+ metadata.gz: 84fb9b34002bed8fe52e89fe76f12c611a4c8d615ba8a4e5e11267c0b6deba99
4
+ data.tar.gz: 05373b62d95ff9599775eb1bf8a2d8ac060ba3f61baf4569ea63de94bf4d2199
5
5
  SHA512:
6
- metadata.gz: cb09f90f72233e3de2b672aca0c1d3ef04f56ced05440a6a37bd31eb029bf6e23b46e4e880b859dbce4d5ba1a162b8d3841edb5c04d7ed7fa7b67edb06db4ab2
7
- data.tar.gz: 2740782db327af3741d4627fccce8d4af0875830d007171df7f9b705fab0faecd8fe3ccdb820d601a7079f78f9a838ab295b0acbc7f64f322b1eb6a2c97b4cb5
6
+ metadata.gz: 94d50dfcd3ea5fa3b716aacc1dd39d2f6455c0d325d6b7cc0fb91d31952aafa48fd7c040451ffeb17248ffaff9337e2d3728881223a5916581c2b1529f529afb
7
+ data.tar.gz: 4216880a6c17df8b73cfa9c7828da975518b1b5dfb7dac7c6b38e996338a6b987673c2e43a136ec4273ba68dad6651c14ce01e495888ab6ffa622819017d9a42
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ 0.3.21
2
+ ===
3
+ - Bugfix for `*assign` processing.
4
+
1
5
  0.3.20
2
6
  ===
3
7
  - Support escaping unicode escape sequences so they are not replaced by unicode characters.
@@ -3086,5 +3086,43 @@
3086
3086
  "escapes"
3087
3087
  ],
3088
3088
  "minimised_modl": "test=\\\\~u2019\\\\u2019~u2019\\\\u2019"
3089
+ },
3090
+ {
3091
+ "id": "324",
3092
+ "input": "test=~~u2019",
3093
+ "expected_output": "{\n \"test\": \"~u2019\"\n}",
3094
+ "tested_features": [
3095
+ "unicode",
3096
+ "escapes"
3097
+ ],
3098
+ "minimised_modl": "test=~~u2019"
3099
+ },
3100
+ {
3101
+ "id": "325",
3102
+ "input": "test=\\~u2019",
3103
+ "expected_output": "{\n \"test\": \"~u2019\"\n}",
3104
+ "tested_features": [
3105
+ "unicode",
3106
+ "escapes"
3107
+ ],
3108
+ "minimised_modl": "test=\\~u2019"
3109
+ },
3110
+ {
3111
+ "id": "326",
3112
+ "input": "*class(\n *id=v;\n *name=variants;\n *assign=[[variant*]]\n);\n\n*class(\n *id=variant;\n *assign=[[key1;key2;key3]]\n);\n\nv[[one;two;three];[four;five;six]]",
3113
+ "expected_output": "{\n \"variants\": [\n {\n \"key1\": \"one\",\n \"key2\": \"two\",\n \"key3\": \"three\"\n },\n {\n \"key1\": \"four\",\n \"key2\": \"five\",\n \"key3\": \"six\"\n }\n ]\n}",
3114
+ "tested_features": [
3115
+ "class"
3116
+ ],
3117
+ "minimised_modl": "*class(*id=v;*name=variants;*assign=[[variant*]]);*class(*id=variant;*assign=[[key1;key2;key3]]);v[[one;two;three];[four;five;six]]"
3118
+ },
3119
+ {
3120
+ "id": "327",
3121
+ "input": "*class(\n *id=v;\n *name=variants;\n *assign=[[variant*]]\n);\n\n*class(\n *id=variant;\n *assign=[[key1;key2;key3]]\n);\n\nv[one:two:three]",
3122
+ "expected_output": "{\n \"variants\": [\n {\n \"key1\": \"one\",\n \"key2\": \"two\",\n \"key3\": \"three\"\n }\n ]\n}",
3123
+ "tested_features": [
3124
+ "class"
3125
+ ],
3126
+ "minimised_modl": "*class(*id=v;*name=variants;*assign=[[variant*]]);*class(*id=variant;*assign=[[key1;key2;key3]]);v[[one;two;three];[four;five;six]]"
3089
3127
  }
3090
3128
  ]
@@ -254,6 +254,7 @@ module MODL
254
254
  result = true
255
255
  lists.each do |list|
256
256
  list.each do |item|
257
+ item = Sutil.head(item) if item.end_with? '*'
257
258
  global_class = global.classs(item)
258
259
  result &= (!global_class.nil? && has_assign_statement?(global_class, global))
259
260
  end
@@ -353,18 +354,24 @@ module MODL
353
354
  end
354
355
  end
355
356
  end
357
+ new_value.keys do |nk|
358
+ process_obj global, new_value[nk]
359
+ end
360
+
361
+ process_nested_classes(global, new_value)
362
+ clazz.merge_content(new_value)
356
363
  else
357
364
  keys.each_index do |i|
358
- new_value[keys[i]] = lam.call(i)
365
+ tmp_value = {keys[i] => v[i]}
366
+ process_obj global, tmp_value
367
+ if !global.classs(keys[i]).nil? && !tmp_value[keys[i]].nil? && (tmp_value[keys[i]].is_a?(Hash) || tmp_value[keys[i]].is_a?(Array))
368
+ new_value[i] = tmp_value[keys[i]]
369
+ else
370
+ new_value.merge! tmp_value
371
+ end
359
372
  end
373
+ new_value
360
374
  end
361
-
362
- new_value.keys do |nk|
363
- process_obj global, new_value[nk]
364
- end
365
-
366
- process_nested_classes(global, new_value)
367
- clazz.merge_content(new_value)
368
375
  end
369
376
 
370
377
  # Find a *assign key list of a specific length
@@ -24,6 +24,6 @@
24
24
 
25
25
  module MODL
26
26
  module Parser
27
- VERSION = "0.3.20"
27
+ VERSION = "0.3.21"
28
28
  end
29
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.20
4
+ version: 0.3.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Walmsley
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-15 00:00:00.000000000 Z
11
+ date: 2019-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake