Module: SurveyorParserQuestionGroupMethods

Defined in:
lib/surveyor/parser.rb

Overview

QuestionGroup model

Instance Method Summary collapse

Instance Method Details

#clear(context) ⇒ Object



248
249
250
251
252
253
254
255
256
257
258
# File 'lib/surveyor/parser.rb', line 248

def clear(context)
  [ :question_group,
    :grid_answers,
    :question,
    :dependency,
    :dependency_condition,
    :answer,
    :validation,
    :validation_condition ].each{|k| context.delete k}
  context[:grid_answers] = []
end

#parse_and_build(context, args, original_method, reference_identifier) ⇒ Object



237
238
239
240
241
242
243
244
245
246
247
# File 'lib/surveyor/parser.rb', line 237

def parse_and_build(context, args, original_method, reference_identifier)
  # clear context
  clear(context)

  # build and set context
  self.attributes = ({
    :text => args[0] || "Question Group",
    :reference_identifier => reference_identifier,
    :display_type => (original_method =~ /grid|repeater/ ? original_method : "default")}.merge(args[1] || {}))
  context[:question_group] = self
end