Module: SurveyorParserSurveySectionMethods

Defined in:
lib/surveyor/parser.rb

Overview

SurveySection model

Instance Method Summary collapse

Instance Method Details

#clear(context) ⇒ Object



222
223
224
225
226
227
228
229
230
231
232
# File 'lib/surveyor/parser.rb', line 222

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

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



210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/surveyor/parser.rb', line 210

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

  # build and set context
  title = args[0]
  self.attributes = ({
    :title => title,
    :reference_identifier => reference_identifier,
    :display_order => context[:survey].sections.size }.merge(args[1] || {}))
  context[:survey].sections << context[:survey_section] = self
end