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, #rubify

Constructor Details

#initialize(cond, when_true, when_false) ⇒ CondBase

Returns a new instance of CondBase.



75
76
77
# File 'lib/nydp/cond.rb', line 75

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

Instance Method Details

#inspectObject



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

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

#lexical_reach(n) ⇒ Object



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

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

#to_sObject



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

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