Class: ValidationCondition
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ValidationCondition
- Defined in:
- lib/surveyor/unparser.rb,
app/models/validation_condition.rb
Instance Method Summary collapse
-
#unparse(dsl) ⇒ Object
nonblock.
Methods included from Surveyor::Models::ValidationConditionMethods
included, #is_valid?, #to_hash
Instance Method Details
#unparse(dsl) ⇒ Object
nonblock
139 140 141 142 143 144 145 146 |
# File 'lib/surveyor/unparser.rb', line 139 def unparse(dsl) attrs = (self.attributes.diff ValidationCondition.new.attributes).delete_if{|k,v| %w(created_at updated_at operator rule_key id validation_id).include? k}.symbolize_keys! dsl << " " if validation.answer.question.part_of_group? dsl << " condition" dsl << "_#{rule_key}" unless rule_key.blank? dsl << " \"#{operator}\"" dsl << (attrs.blank? ? "\n" : ", #{attrs.inspect.gsub(/\{|\}/, "")}\n") end |