Class: IfRelationship
- Inherits:
-
Object
- Object
- IfRelationship
- Defined in:
- lib/cauldron/if_relationship.rb
Overview
< Relationship
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(problems) ⇒ IfRelationship
constructor
TODO Need to change to IfSolution probably.
- #to_ruby(variables) ⇒ Object
Constructor Details
#initialize(problems) ⇒ IfRelationship
TODO Need to change to IfSolution probably
5 6 7 |
# File 'lib/cauldron/if_relationship.rb', line 5 def initialize(problems) @problems = problems end |
Class Method Details
.match?(problems) ⇒ Boolean
21 22 23 |
# File 'lib/cauldron/if_relationship.rb', line 21 def self.match?(problems) true end |
Instance Method Details
#to_ruby(variables) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/cauldron/if_relationship.rb', line 9 def to_ruby(variables) # Add the arguments result = '' @problems.each_with_index do |x,i| result += ' if '+variables[0].to_s+' == '+quote(x.arguments[0])+"\n" result += ' return '+quote(x.response)+"\n" result += ' end'+"\n" end result end |