Class: Dependency

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Surveyor::Models::DependencyMethods
Defined in:
app/models/dependency.rb,
lib/surveyor/unparser.rb

Instance Method Summary collapse

Methods included from Surveyor::Models::DependencyMethods

#conditions_hash, included, #is_met?, #question_group_id=, #question_id=

Instance Method Details

#unparse(dsl) ⇒ Object

nonblock



84
85
86
87
88
89
90
# File 'lib/surveyor/unparser.rb', line 84

def unparse(dsl)
  attrs = (self.attributes.diff Dependency.new.attributes).delete_if{|k,v| %w(created_at updated_at id question_id).include?(k) }.symbolize_keys!
  dsl << "  " if question.part_of_group?
  dsl << "    dependency"
  dsl << (attrs.blank? ? "\n" : " #{attrs.inspect.gsub(/\{|\}/, "")}\n")
  dependency_conditions.each{|dependency_condition| dependency_condition.unparse(dsl)}
end