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 +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/quby/compiler/dsl/questionnaire_builder.rb +7 -6
- data/lib/quby/compiler/dsl/score_schema_builder.rb +4 -1
- data/lib/quby/compiler/entities/score_schema.rb +2 -0
- data/lib/quby/compiler/outputs/roqua_serializer.rb +2 -1
- data/lib/quby/compiler/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c67c97d2289ad5d667210d7b94f0466db944c8a700c01c92716b9898cca68c83
|
4
|
+
data.tar.gz: feacb4c74bb03b070f52f27941dc7fa0c295c838234fffbdef7775776cf9fe4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0382c9f29784de1b6354abc7e7400ac12a008a7ccf6933182ad9bd73040e9c1398483b560ac913a4148ec9732aad494f09ccda939adf8892cf56473bea7f34f
|
7
|
+
data.tar.gz: 713fdaa372295c835cb5755dddb7c87e3b63d767dfbb6acbebc8f78fb993d1deb0c152026404c06adc1300848fef9ddb2e5b465134ca2e42c830963824eb9a31
|
data/CHANGELOG.md
CHANGED
@@ -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,
|
219
|
+
def score_schema(key, label, subscore_schemas = nil, sbg_key: nil, &block)
|
220
220
|
if block
|
221
|
-
schema, calculations = ScoreSchemaBuilder.build(key
|
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
|
228
|
-
label
|
229
|
-
|
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
|
|
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
|
+
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-
|
11
|
+
date: 2023-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|