data is code It is important for one to think of code as data to understand what eval is all about. The idea is that the code itself can be manifested as a primitive data type which the language can then make sense of. program.has_detox_readiness == true program.cycle_parity == 'odd' Kernel.eval()
input_object.respond_to?(self.attribute_name) @evaluation_result = (input_object.send(self.attribute_name) == (self.value == 1)) else false end end end end # ingredient.rb include InferenceEngine::Inference # ingredient_rule.rb include InferenceEngine::Rule
= 0 @evaluated_rules = [] rules.each do |rule| @evaluated_rules << rule if rule.evaluate(input_object) case rule.human_rule_type when :exclude @excluded = true return when :prioritize @priority_level += 1 when :penalize @priority_level -= 1 end end end end