Module: Quby::Questionnaires::DSL

Defined in:
lib/quby/questionnaires/dsl.rb

Class Method Summary collapse

Class Method Details

.build(key, sourcecode = nil, timestamp: nil, &block) ⇒ Object

Deprecated, precompile elsewhere and use from_json



14
15
16
17
18
# File 'lib/quby/questionnaires/dsl.rb', line 14

def self.build(key, sourcecode = nil, timestamp: nil, &block)
  compiled = Quby::Compiler.compile(key, sourcecode, lookup_tables: {}, &block)
  data = JSON.parse(compiled[:outputs][:quby_frontend_v1].content)
  Deserializer.from_json(data)
end

.build_from_definition(definition) ⇒ Object

Deprecated, precompile elsewhere and use from_json



7
8
9
10
11
# File 'lib/quby/questionnaires/dsl.rb', line 7

def self.build_from_definition(definition)
  compiled = Quby::Compiler.compile(definition.key, definition.sourcecode, lookup_tables: {}, path: definition.path)
  data = JSON.parse(compiled[:outputs][:quby_frontend_v1].content)
  Deserializer.from_json(data)
end

.from_json(hash) ⇒ Object



20
21
22
# File 'lib/quby/questionnaires/dsl.rb', line 20

def self.from_json(hash)
  Deserializer.from_json(hash)
end