Class: Quby::Compiler::Outputs::SeedSerializer

Inherits:
Object
  • Object
show all
Defined in:
lib/quby/compiler/outputs/seed_serializer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(questionnaire) ⇒ SeedSerializer

Returns a new instance of SeedSerializer.



10
11
12
13
# File 'lib/quby/compiler/outputs/seed_serializer.rb', line 10

def initialize(questionnaire)
  @questionnaire = questionnaire
  @seeds = seeds || []
end

Instance Attribute Details

#questionnaireObject (readonly)

Returns the value of attribute questionnaire.



7
8
9
# File 'lib/quby/compiler/outputs/seed_serializer.rb', line 7

def questionnaire
  @questionnaire
end

#seedsObject (readonly)

Returns the value of attribute seeds.



8
9
10
# File 'lib/quby/compiler/outputs/seed_serializer.rb', line 8

def seeds
  @seeds
end

Instance Method Details

#generateObject



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/quby/compiler/outputs/seed_serializer.rb', line 15

def generate
  questionnaire.roqua_keys.map do |roqua_key|
    new_seed = Services::QubyProxy.new(
      questionnaire,
      quby_key: questionnaire.key,
      roqua_key: roqua_key,
      skip_score_keys_consistency_check: true
    ).generate

    Services::SeedDiff.new.apply_patch(new_seed, questionnaire.seeds_patch[roqua_key])
  end
end