Evaluate a conditional expression
- s
- string to evaluate
- sytab
- the symbol table context
# File fileproc.rb, line 109
def initialize(s, sytab)
@s = s
@sytab = sytab
end
Provided so expressions can contain 'defined("FOO")' tests
- sy
- name of symbol to check symbol table for
# File fileproc.rb, line 117
def defined(sy)
@sytab.key?(sy)
end
Provided so expressions can contain 'exists("FOO")' tests
- fn
- name of file to check for existence
# File fileproc.rb, line 124
def exists(fn)
File::exists?(fn)
end
Replace symbols with values and pass to Ruby for evaluation; Result is
interpreted as true/false.
# File fileproc.rb, line 131
def value()
eval(@sytab << @s)
end