Class: DynamicFieldsets::DependencyClause
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- DynamicFieldsets::DependencyClause
- Defined in:
- app/models/dynamic_fieldsets/dependency_clause.rb
Overview
A clause in CNF expression for question dependencies
Instance Method Summary collapse
-
#evaluate(input_values) ⇒ Boolean
Evaluates the depdendencies in the claus by ORing them together Short circuit evaluation returns true as soon as possible.
- #to_hash ⇒ Object
Instance Method Details
#evaluate(input_values) ⇒ Boolean
Evaluates the depdendencies in the claus by ORing them together Short circuit evaluation returns true as soon as possible
20 21 22 23 24 25 26 27 |
# File 'app/models/dynamic_fieldsets/dependency_clause.rb', line 20 def evaluate(input_values) self.dependencies.each do |dependency| if dependency.evaluate return true end end return false end |
#to_hash ⇒ Object
29 30 31 |
# File 'app/models/dynamic_fieldsets/dependency_clause.rb', line 29 def to_hash return { "id" => self.id, "dependency_group_id" => self.dependency_group_id } end |