Class Cond
In: fileproc.rb
Parent: Object

Evaluate a conditional expression

Methods
defined    exists    new    value   
Public Class methods
new(s, sytab)
s
string to evaluate
sytab
the symbol table context
# File fileproc.rb, line 109
  def initialize(s, sytab)
    @s = s
    @sytab = sytab
  end
Public Instance methods
defined(sy)

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
exists(fn)

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
value()

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