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



381
382
383
384
385
386
387
388
389
390
391
# File 'lib/surveyor/parser.rb', line 381

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