Class: DependencyCondition
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- DependencyCondition
- Defined in:
- lib/surveyor/unparser.rb,
app/models/dependency_condition.rb
Instance Method Summary collapse
-
#unparse(dsl) ⇒ Object
nonblock.
Methods included from Surveyor::Models::DependencyConditionMethods
Methods included from Surveyor::ActsAsResponse
Instance Method Details
#unparse(dsl) ⇒ Object
nonblock
105 106 107 108 109 110 111 112 113 |
# File 'lib/surveyor/unparser.rb', line 105 def unparse(dsl) with_defaults = DependencyCondition.new attrs = self.attributes.delete_if{|k,v| with_defaults[k] == v or %w(created_at updated_at question_id question_group_id rule_key rule operator id dependency_id answer_id).include? k}.symbolize_keys! dsl << " " if dependency.question.part_of_group? dsl << " condition" dsl << "_#{rule_key}" unless rule_key.blank? dsl << " :q_#{question.reference_identifier}, \"#{operator}\"" dsl << (attrs.blank? ? ", {:answer_reference=>\"#{answer && answer.reference_identifier}\"}\n" : ", {#{attrs.inspect.gsub(/\{|\}/, "")}, :answer_reference=>\"#{answer && answer.reference_identifier}\"}\n") end |