quby-compiler 0.5.4 → 0.5.5

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: 298486fbde9a0b1e4873a639011c6a4fe6c00dd98430a42d2a79afdb0fb92584
4
- data.tar.gz: e79bee94168384f1c17fa9abdfd2f9f0d4fd6036a166047474d44f4ab95c7da7
3
+ metadata.gz: c67c97d2289ad5d667210d7b94f0466db944c8a700c01c92716b9898cca68c83
4
+ data.tar.gz: feacb4c74bb03b070f52f27941dc7fa0c295c838234fffbdef7775776cf9fe4e
5
5
  SHA512:
6
- metadata.gz: 23233110d98eae072f27e537f2a2ad2c60e47c7a9b76448502f9f73f1ccc3ee8dbda257e88c048b37c74a38f90afeff239e261dd0f6e85a1fe219c534078f880
7
- data.tar.gz: b2a3ab1acf6c92160a9a5a23affcb8b9174f032b476d3deb613d5f1d6e352e15bb2447f9a8ed2bdb0ab91f2364e6dc29b378294b0094b516256ee077d5dc3b6e
6
+ metadata.gz: c0382c9f29784de1b6354abc7e7400ac12a008a7ccf6933182ad9bd73040e9c1398483b560ac913a4148ec9732aad494f09ccda939adf8892cf56473bea7f34f
7
+ data.tar.gz: 713fdaa372295c835cb5755dddb7c87e3b63d767dfbb6acbebc8f78fb993d1deb0c152026404c06adc1300848fef9ddb2e5b465134ca2e42c830963824eb9a31
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 0.5.5
2
+
3
+ * roqua.json:
4
+ * Add sbg_key to scores
5
+
1
6
  # 0.5.4
2
7
 
3
8
  * quby2:
@@ -212,21 +212,22 @@ module Quby
212
212
  def score(key, **options, &block)
213
213
  @questionnaire.errors.add "Score #{key}", 'misses label in score call' if options[:label].blank?
214
214
  schema = options.delete(:schema)
215
- score_schema(key, options[:label], schema) if schema.present?
215
+ score_schema(key, options[:label], schema, sbg_key: options[:sbg_key]) if schema.present?
216
216
  variable(key, score: true, **options, &block)
217
217
  end
218
218
 
219
- def score_schema(key, label, options = nil, &block)
219
+ def score_schema(key, label, subscore_schemas = nil, sbg_key: nil, &block)
220
220
  if block
221
- schema, calculations = ScoreSchemaBuilder.build(key: key, label: label, &block)
221
+ schema, calculations = ScoreSchemaBuilder.build(key:, label:, sbg_key:, &block)
222
222
  @questionnaire.add_score_schema schema
223
223
  calculations.each do |calculation|
224
224
  @questionnaire.add_score_calculation calculation
225
225
  end
226
226
  else
227
- @questionnaire.add_score_schema Entities::ScoreSchema.new key: key,
228
- label: label,
229
- subscore_schemas: options
227
+ @questionnaire.add_score_schema Entities::ScoreSchema.new key:,
228
+ label:,
229
+ sbg_key:,
230
+ subscore_schemas:
230
231
  end
231
232
  end
232
233
 
@@ -4,9 +4,10 @@ module Quby
4
4
  module Compiler
5
5
  module DSL
6
6
  class ScoreSchemaBuilder < Base
7
- def initialize(key:, label:, &block)
7
+ def initialize(key:, label:, sbg_key: nil, &block)
8
8
  @score_key = key
9
9
  @score_label = label
10
+ @score_sbg_key = sbg_key
10
11
  @subschema_params = []
11
12
  @generated_calculations = []
12
13
  end
@@ -14,6 +15,7 @@ module Quby
14
15
  def build
15
16
  score_schema = Entities::ScoreSchema.new key: @score_key,
16
17
  label: @score_label,
18
+ sbg_key: @score_sbg_key,
17
19
  subscore_schemas: @subschema_params
18
20
  [score_schema, @generated_calculations + [generate_score_calculation(score_schema)]]
19
21
  end
@@ -44,6 +46,7 @@ module Quby
44
46
  score_code_string = "score do\n {#{inner_hash_string}}\nend"
45
47
  Entities::ScoreCalculation.new score_schema.key,
46
48
  label: score_schema.label,
49
+ sbg_key: score_schema.sbg_key,
47
50
  score: true,
48
51
  ruby_string: score_code_string
49
52
  end
@@ -13,6 +13,8 @@ module Quby
13
13
  attribute :key, Types::Symbol
14
14
  # A label describing the general purpose of the score
15
15
  attribute :label, Types::String
16
+ # Alternative key used by some external systems
17
+ attribute :sbg_key?, Types::String.optional
16
18
  # An array of SubscoreSchemas describing each key that can be returned in the result hash of a score.
17
19
  attribute :subscore_schemas, Types::Array(Entities::SubscoreSchema)
18
20
 
@@ -248,8 +248,9 @@ module Quby
248
248
  {
249
249
  key: score.key,
250
250
  label: score.label,
251
+ sbg_key: score.sbg_key,
251
252
  subscores: subscores_for(score)
252
- }
253
+ }.compact
253
254
  }
254
255
  end
255
256
 
@@ -1,5 +1,5 @@
1
1
  module Quby
2
2
  module Compiler
3
- VERSION = "0.5.4"
3
+ VERSION = "0.5.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quby-compiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Veldthuis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-10 00:00:00.000000000 Z
11
+ date: 2023-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel