Class: Nydp::CondBase

Inherits:
Object show all
Extended by:
Helper
Includes:
Helper
Defined in:
lib/nydp/cond.rb

Instance Method Summary collapse

Methods included from Helper

cons, list, literal?, pair?, sig, sym, sym?

Methods included from Converter

#n2r, #r2n

Constructor Details

#initialize(cond, when_true, when_false) ⇒ CondBase

Returns a new instance of CondBase.



79
80
81
# File 'lib/nydp/cond.rb', line 79

def initialize cond, when_true, when_false
  @condition, @when_true, @when_false = cond, when_true, when_false
end

Instance Method Details

#inspectObject



87
# File 'lib/nydp/cond.rb', line 87

def inspect ; "cond:#{@condition.inspect}:#{@when_true.inspect}:#{@when_false.inspect}" ; end

#lexical_reach(n) ⇒ Object



83
84
85
# File 'lib/nydp/cond.rb', line 83

def lexical_reach n
  [@condition.lexical_reach(n), @when_true.lexical_reach(n), @when_false.lexical_reach(n)].max
end

#to_sObject



88
# File 'lib/nydp/cond.rb', line 88

def to_s    ; "(cond #{@condition.to_s} #{@when_true.to_s} #{@when_false.to_s})" ; end