Module: SurveyorParserValidationMethods

Defined in:
lib/surveyor/parser.rb

Overview

Validation model

Instance Method Summary collapse

Instance Method Details

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



402
403
404
405
406
407
408
409
410
411
412
# File 'lib/surveyor/parser.rb', line 402

def parse_and_build(context, args, original_method, reference_identifier)
  # clear context
  [ :validation,
    :validation_condition ].each{|k| context.delete k}

  context.delete_if{|k,v| %w(validation validation_condition).map(&:to_sym).include? k}

  # build and set context
  self.attributes = ({:rule => "A"}.merge(args[0] || {}))
  context[:answer].validations << context[:validation] = self
end