Module: SurveyorParserQuestionGroupMethods

Defined in:
lib/surveyor/parser.rb

Overview

QuestionGroup model

Instance Method Summary collapse

Instance Method Details

#clear(context) ⇒ Object



227
228
229
230
231
232
233
234
235
236
237
# File 'lib/surveyor/parser.rb', line 227

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



216
217
218
219
220
221
222
223
224
225
226
# File 'lib/surveyor/parser.rb', line 216

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