Module: SurveyorParserSurveySectionMethods

Defined in:
lib/surveyor/parser.rb

Overview

SurveySection model

Instance Method Summary collapse

Instance Method Details

#clear(context) ⇒ Object



186
187
188
189
190
191
192
193
194
195
196
# File 'lib/surveyor/parser.rb', line 186

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



175
176
177
178
179
180
181
182
183
184
185
# File 'lib/surveyor/parser.rb', line 175

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,
    :display_order => context[:survey].sections.size }.merge(args[1] || {}))
  context[:survey].sections << context[:survey_section] = self
end