Module: SurveyorParserSurveySectionMethods

Defined in:
lib/surveyor/parser.rb

Overview

SurveySection model

Instance Method Summary collapse

Instance Method Details

#clear(context) ⇒ Object



201
202
203
204
205
206
207
208
209
210
211
# File 'lib/surveyor/parser.rb', line 201

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



189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/surveyor/parser.rb', line 189

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