class Upl::Variables
Storage from variables, where setting one just calls unify on the underlying terms. Cos it's hard to hang unify on a single variable.
Public Class Methods
new(*names)
click to toggle source
Calls superclass method
# File lib/upl/variables.rb, line 5 def initialize *names super names.each do |name| self.store name, Variable.new end end
Public Instance Methods
[]=( name, term )
click to toggle source
calls unify, so you can't set a given variable more than once.
# File lib/upl/variables.rb, line 13 def []=( name, term ) Extern::PL_unify self[name.to_sym].to_term_t, term.to_term_t end
method_missing(meth, *args)
click to toggle source
Calls superclass method
# File lib/upl/variables.rb, line 17 def method_missing meth, *args # unfreeze name = meth.to_s.dup the_method = if name.chomp! '=' # set the value :'[]=' else # fetch the value :'[]' end var_name = name.to_sym if has_key? var_name send the_method, var_name, *args else super end end
pretty_print(pp)
click to toggle source
# File lib/upl/variables.rb, line 39 def pretty_print pp transform_values{|v| v.to_ruby}.pretty_print pp end